[Zope-CMF] Change doc type
Tres Seaver
tseaver@zope.com
20 May 2002 09:28:03 -0400
On Mon, 2002-05-20 at 08:43, Kevin Carlson wrote:
> I have several CMF types that are essentially the CMF File meta_type with
> the "Meta type" attribute changed to another name (e.g., Press Release).
> Since all of these are based on the CMFDefault product and the File portal
> type, is there a way after creation that I could change an existing type
> instance from one type to another (e.g. Press Release --> Company
> Announcement) . I know I could do this by programmatically deleting the
> existing instance and re-adding the new type with the same metadata, but I
> was hoping for an easier way. Any ideas?
You *can* do this, if you take responsibility for fixing up any issues
(e.g., even though they are all CMFDefault.File under the covers, they
may have different workflows associated with them)::
#external method, because '_setPortalTypeName' method is private
def convertFilePortalType( self, new_type ):
" Convert type on the fly. "
# TODO: Add security check here?
self._setPortalTypeName( new_type )
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com