Re: converting from folder to publication

"Kit BLAKE" <[email protected]> Fri, 11 Jan 2008 12:52:41 +0100
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
2008/1/10, Andy Altepeter <[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?

"Converting from folder to publication" is older code than the
SwitchClass pattern used when SilvaDocument was moved out of the Silva
core, so maybe.... give it a shot.

-- 
Kit BLAKE · Infrae · http://infrae.com/ + 31 10 243 7051
Hoevestraat 10 · 3033 GC · Rotterdam + The Netherlands
OpenPGP 0xE67AD0F2 · Contact = http://xri.net/=kitblake
_______________________________________________
silva-dev mailing list
[email protected]
https://lists.infrae.com/mailman/listinfo/silva-dev