Re: converting from folder to publication

Andy Altepeter <[email protected]> Fri, 11 Jan 2008 08:41:30 -0600
Newsgroups gmane.comp.web.zope.silva.devel
Organization Bethel University
Message-ID <[email protected]>
> > 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.

Well, a quick test seems to have very positive results (and it's very fast)!  
Since the entire object's data dictionary is copied to the new object, there 
isn't any data loss.  And as I pointed out, there are now instance variables 
in Publication, so nothing needs to be done with that.

I'm going to check this into the Silva trunk, so others can test as well.