converting from folder to publication

Andy Altepeter <[email protected]> Thu, 10 Jan 2008 12:10:40 -0600
Newsgroups gmane.comp.web.zope.silva.devel
Organization Bethel University
Message-ID <[email protected]>
Greetings!

Converting from folder to publication is _really_ slow!  We're in a zeo 
environment so that is perhaps a contributing factor, but...

We're switching news folders that are now 'archives', e.g. folders containing 
2007 news, to publications.  When converting, I use a Zeo client that has 
absolutely no load.  I'm using zope.testbrowser to get around potential 
browser timeouts (or the occasional browser test)...I can use screen and a 
console to disconnect and come back later if I need to take my laptop 
somewhere. (but that's beside the point)

I eventually get an HTTP 503: Service Unavailable error, so I can't use a user 
agent to convert.  I tried using zopectl debug, but converting to publication 
requires a REQUEST object.

So, I looked at Folder._convert_to_publication.  This function renames the 
folder (which is slow), creates the publication (fast), copies all contents 
in the folder to the publication (slow), then removes the folder.  This is a 
normal pattern when doing this sort of thing.  But is there a faster way?

I know that when SilvaDocument was moved out of the Silva core, a SwitchClass 
pattern was used, that basically just changed what class SilvaDocument 
objects were.  Couldn't something like that be used for this conversion?

Given that Publications subclass Folders, and Publications have no instance 
variables, do you think this method would work?

Cheers,
Andy