[Zope3-dev] Enabling services

Marius Gedminas mgedmin@codeworks.lt
Wed, 11 Dec 2002 19:53:46 +0200


A recent update to SiteDefinition.py contains the following snippet

        sc = ServiceConfiguration('ObjectHub', here + ('ObjectHub-1',))
        configure.setObject(None, sc)

        # XXX I want to register and possibly activate these services,
        #     but the following code doesn't work. :-(
        ##sc.status = "Active"
        # XXX And the following code doesn't work either. :-(
        registry = sm.createConfigurationsFor(sc)
        ##registry.register(sc)
        ##registry.activate(sc)

sc needs to be context wrapped, e.g. by doing this

  key = configure.setObject(None, sc)
  sc = configure[key]

Then

  sc.status = Active

will work (import Active from Zope.App.OFS.Service.ConfigurationInterfaces).

Hm...

  configure[configure.setObject(None, sc)].status = Active

Maybe not. :-)

Marius Gedminas
-- 
The IQ of the group is the lowest IQ of a member of
the group divided by the number of people in the group.