[Zope3-Users] Re: Creating objects in software space when making
site
Andreas Elvers
andreas at work.de
Sat Mar 11 08:32:34 EST 2006
Michael Howitz wrote:
> Am Dienstag, den 07.03.2006, 09:06 -0700 schrieb Jeff Shell:
>> On 3/6/06, Florian Lindner <mailinglists at xgm.de> wrote:
> [...]
>> # Get the default registration
>> default = context.getSiteManager()['default']
>> reg_manager = default.registrationManager
>>
>> if 'intid' not in default:
>> # There's a shorter way to do this, but I can never remember what it is
>> intid = IntIds()
>> default['intid'] = intid
>> intids_reg = UtilityRegistration('', IIntIds, intid)
>> reg_manager.addRegistration(intids_reg)
>> intids_reg.status = ActiveStatus
>
> The shorter way is:
> zope.app.appsetup.bootstrap.ensureUtility(
> context, IIntIds, '', IntIds, copy_to_zlog=False)
>
>
nice :-)
The event driven initialization is probably the best way to go. I tried
the same with tiks.initializer (from
http://svn.tiks.org/svn/repos/tiks.initializer/trunk) under zope3.1. I
had problems to get it to work, so I switched to the view based
initialization. Have to retry it though.
- Andreas
More information about the Zope3-users
mailing list