def manageLink(self, obj, normalled): # need IObject iface for catalog brains if hasattr(obj, 'getObject'): # brain, other sort of pseudo object obj = obj.getObject() if not IReferenceable.providedBy(obj): # backlink not possible return mark(obj, IWickedTarget) self.refcat.addReference(obj, self.context, relationship=self.relation, referenceClass=self.refKlass) objuid = IUID(obj) path = '/'.join(obj.getPhysicalPath()) data = dict(path=path, icon=obj.getIcon(), uid=objuid) self.cm.set((intern(str(normalled)), objuid), [data])
def dummy(kdict, name='dummy', iface=ITestObject, bases=(object,)): """ factory for dummies """ obj = type(name, bases, kdict)() mark(obj, iface) return obj