Skip to content

Weblog About Jim Jim's Resume Discussion Mailing List Search
  You are not logged in Link icon Log in Link icon Join
You are here: upstreamed � Help! How to deal with moved/renamed files?

Twitter Updates
Pro Services

Jim Roepcke specializes in iPhone and Cocoa (Objective-C), WebObjects (Java), and Python.

  • consultation
  • development
  • documentation
  • mentoring

Contact Jim for more information.

Python Tutorial

I presented the Introduction to Python for Plone developers tutorial at the first Plone conference in October 2003. Slides and Video are available to all on the plone.org site.

Badges

Proud Member of the ACM

Proud Member of the Association for Computing Machinery

RSS reader for Mac OS X

NetNewsWire: More news, less junk. Faster

Fantasy Trading of HBWT at:

Listed on BlogShares

Design by:

Powered by Plone
Blog Directory - Blogged
Log in
Name

Password

 
I forgot my password; please send me a new one.
 

Help! How to deal with moved/renamed files?

When a file is upstreamed to Conversant, I check to see if there is already a page at its target URL in the CMS. If there is, I update the message that is bound to that existing page, otherwise, I create a new message and bind it to that target URL.

If I delete that file, I have two choices: delete the URL binding in the CMS, but leave the message in the CMS (since it might have become a topic for discussion), or, delete the binding and the message. I'm going to make that a preference.

Here's the part I'm agonizing over: if you rename a file or move it to a different folder managed by the same upstreaming settings, what should I do? Radio will tell my driver to delete the existing file and then create a new one, since that's what happened from it's POV. From your point of view the message should simply be retargeted to a new URL, so the discussion thread under it stays in place.

How can I do that? I need metadata. I could stash the message number in the file's resource fork (if you're using a Mac). Windows has forks too (seriously) but they aren't exposed in Radio. Anyway, that's a fragile solution.

Here's my proposal. Put a GUID in the file. (GUID stands for Globally Unique IDentifier) If you want a file to persist in a known message:

  • Create a GUID custom field in your Conversant conversation.
  • Put CONVERSANT-GUID: <%GUID%> at the top of your #template.txt file
  • Add a #GUID directive line to the content (.txt) file. Example:
    #GUID "laksjfaoj23r0jaf"
  • The upstreaming driver tells Radio to render the .txt file (through the template). If it sees the GUID at the top of the file, it checks if that GUID exists in the conversation already. If it exists, the message with that GUID is updated and so is the URL binding (if necessary). If it's not found, it creates the message, saves the GUID, and binds the message to the correct URL as normal.

What to put in the GUID? You can't use the message number because you don't know it in advance (and I don't want to add the hurdle of requesting one). You could use some GUID generator but that's just as bad a message # request hurdle. You could thrash at the keyboard... I think that's reasonably safe if the string is long enough, but yes it's laughable and not foolproof.

You COULD use the message number if you add the GUID after the fact. You could even ask the upstreaming driver to generate one for you and put it in the .txt file for you. That would be nice and easy, but there is a downside... the message will be upstreamed twice, since the change in the file will result in Radio re-upstreaming the file. Even if I set the moddate of the file back to the original moddate, Radio could eventually be smart enough to do checksums! (maybe it already does I don't know) Honestly, this isn't such a big deal, but it's not elegant and that really bugs me. :-)

Anyway, the more I think about it the more I think the GUID is appropriate, but I have a suspicion I may be missing something obvious or clever, so if you can think of something better, please let me know.

Thanks for reading all this. :-)

Jim

Discuss...


July 2009
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Jun Aug
 
Sponsors
Research

Jim Roepcke is Willing to Fail

Books

I'm currently reading:

I'm currently reading Programming Erlang

I co-authored:

I co-authored this book