Beispiel #1
0
    def __data__(self):
        if not IBound.providedBy(self):
            raise UnboundPreferenceGroup(self.__id__)

        # set principal data
        self.principal.applySchema(self.__schema__)
        data = self.__schema__(self.principal)

        self.__dict__["__data__"] = data
        return data
Beispiel #2
0
    def __bind__(self, principal=None, parent=None):
        clone = self.__class__.__new__(self.__class__)
        clone.__dict__.update(self.__dict__)

        # set parent
        clone.__parent__ = parent

        # set principal
        if principal is None:
            if IBound.providedBy(parent):
                clone.__principal__ = parent.__principal__
            else:
                clone.__principal__ = getInteraction().participations[0].principal
        else:
            clone.__principal__ = principal

        interface.alsoProvides(clone, IBound)
        return clone
Beispiel #3
0
 def isAvailable(self):
     if not IBound.providedBy(self) or IUnauthenticatedPrincipal.providedBy(self.__principal__):
         return False
     return True
Beispiel #4
0
    def data(self):
        if not IBound.providedBy(self):
            raise UnboundPreferenceGroup()

        return getMultiAdapter((self.__principal__, self), IDataStorage)