コード例 #1
0
def ComponentRegistrationAddSubscriber(componentRegistration, event):
    """Receive notification of add event."""
    component = componentRegistration.component
    try:
        dependents = IDependable(component)
    except TypeError:
        return
    objectpath = zapi.getPath(componentRegistration)
    dependents.addDependent(objectpath)
コード例 #2
0
def getBoundContact(context):
    person = IBasicPerson(removeSecurityProxy(context))
    annotations = IAnnotations(person)
    contact = annotations.get(PERSON_CONTACT_KEY, None)
    if contact is None:
        contact = BoundContact()
        annotations[PERSON_CONTACT_KEY] = contact
        contact.__name__ = 'contact'
        contact.__parent__ = person
        dependable = IDependable(contact)
        dependable.addDependent("")
        notify(ObjectAddedEvent(contact, contact.__parent__, contact.__name__))
    return contact
コード例 #3
0
ファイル: basicperson.py プロジェクト: l1ph0x/schooltool-2
def getBoundContact(context):
    person = IBasicPerson(removeSecurityProxy(context))
    annotations = IAnnotations(person)
    contact = annotations.get(PERSON_CONTACT_KEY, None)
    if contact is None:
        contact = BoundContact()
        annotations[PERSON_CONTACT_KEY] = contact
        contact.__name__ = 'contact'
        contact.__parent__ = person
        dependable = IDependable(contact)
        dependable.addDependent("")
        notify(ObjectAddedEvent(contact, contact.__parent__, contact.__name__))
    return contact