[Zope3-Users] Creating objects in software space when making site

Michael Howitz mh at gocept.com
Wed Mar 8 03:13:17 EST 2006


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)


-- 
Mit freundlichen Grüßen

Michael Howitz



More information about the Zope3-users mailing list