[Zope-CMF] Re: Problems installing type into portal

Anton Hughes antonh at lawtec.net
Wed Mar 3 20:39:30 EST 2004


Thanks Raphael,

Unfortunately (or fortunately, depending on your perspective) when I 
came back to the portal the next day, the type was properly registered 
(maybe due to Zope's undocumented self-repair engine? Wolverine.py?). 
So I didn't get a chance to try this code out :( I'm sure it will come 
in handy further down the track.

Cheers,

Anton

On 03/03/2004, at 8:47 PM, Raphael Ritz wrote:

>
>
> antonh at lawtec.net wrote:
>
>> [...]
>> It seems like the ConflictError I got on the first installation 
>> attempt
>> has somehow fooled the installer into thinking that the type has been
>> registered when it has not, so it is skipping this step on subsequent
>> attempts. Is there a way that I can 'manually' force the registration 
>> of
>> my new type with the portal again?
>
> You could do something like this (in your install or custom
> external method):
>
> def reinstallTypes(self, out):
>     typesTool = getToolByName(self, 'portal_types')
>
>     # Type deletion
>     for f in fti_list:
>         if f['id'] in typesTool.objectIds():
>             out.write('*** Object "%s" already existed in the types 
> tool \
>             => deleting\n' % (f['id']))
>
>             typesTool._delObject(f['id'])
>
>
>     # Type re-creation
>     for f in fti_list:
>         cfm = apply(ContentFactoryMetadata, (), f)
>         typesTool._setObject(f['id'], cfm)
>         out.write('Type "%s" registered with the types tool\n' % 
> (f['id']))
>
>
> where fti_list is a list of factory type informations
>
> Raphael
>
>
>> Thanks,
>> Anton
>> _______________________________________________
>> Zope-CMF maillist  -  Zope-CMF at zope.org
>> http://mail.zope.org/mailman/listinfo/zope-cmf
>> See http://collector.zope.org/CMF for bug reports and feature requests
>
>
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests
>




More information about the Zope-CMF mailing list