def __init__(self): self.env = Environment.getInstance() self.log = logging.getLogger(__name__) self.log.info("initializing object index handler") self.factory = ObjectFactory.getInstance() # Listen for object events zope.event.subscribers.append(self.__handle_events)
# Register pseudo event handler def l(event): print "%s event catched: %s of %s" % (event.__class__.__name__, event.reason, event.uuid) zope.event.subscribers.append(l) # use create, update, remove, move, extend, retract if len(sys.argv) != 2: mode = 'update' else: mode = sys.argv[1] del sys.argv[1] f = ObjectFactory.getInstance() if mode == "create": p = f.getObject('User', u'ou=people,dc=gonicus,dc=de', mode="create") if mode in ["update", "move", "remove"]: p = f.getObject('User', u"cn=Klaus Mustermann,ou=people,dc=gonicus,dc=de") if mode == "extend": p = f.getObject('PosixUser', u'cn=Klaus Mustermann,ou=people,dc=gonicus,dc=de', mode="extend") p.uidNumber = 4711 p.gidNumber = 4711 p.homeDirectory = "/home/cajus" p.commit() exit(0)