Пример #1
0
def is_acquired(ob):
    # Return true if this object is not a direct
    # subobject of its aq_parent object.
    if not hasattr(ob, 'aq_parent'):
        return 0
    if hasattr(aq_base(ob.aq_parent), absattr(ob.id)):
        return 0
    if hasattr(aq_base(ob), 'isTopLevelPrincipiaApplicationObject') and \
            ob.isTopLevelPrincipiaApplicationObject:
        return 0
    return 1
Пример #2
0
def is_acquired(ob):
    # Return true if this object is not a direct
    # subobject of its aq_parent object.
    if not hasattr(ob, 'aq_parent'):
        return 0
    if hasattr(aq_base(ob.aq_parent), absattr(ob.id)):
        return 0
    if hasattr(aq_base(ob), 'isTopLevelPrincipiaApplicationObject') and \
            ob.isTopLevelPrincipiaApplicationObject:
        return 0
    return 1
Пример #3
0
 def get_valid_userids(self):
     item = self
     dict = {}
     _notfound = []
     while 1:
         aclu = getattr(aq_base(item), '__allow_groups__', _notfound)
         if aclu is not _notfound:
             mlu = getattr(aclu, 'maxlistusers', _notfound)
             if not isinstance(mlu, int): mlu = DEFAULTMAXLISTUSERS
             if mlu < 0: raise OverflowError
             un = getattr(aclu, 'user_names', _notfound)
             if un is not _notfound:
                 un = aclu.__of__(item).user_names  # rewrap
                 unl = un()
                 # maxlistusers of 0 is list all
                 if len(unl) > mlu and mlu != 0:
                     raise OverflowError
                 for name in unl:
                     dict[name] = 1
         item = getattr(item, 'aq_parent', _notfound)
         if item is _notfound:
             break
     keys = dict.keys()
     keys.sort()
     return tuple(keys)
Пример #4
0
 def get_valid_userids(self):
     item=self
     dict={}
     _notfound = []
     while 1:
         aclu = getattr(aq_base(item), '__allow_groups__', _notfound)
         if aclu is not _notfound:
             mlu = getattr(aclu, 'maxlistusers', _notfound)
             if not isinstance(mlu, int): mlu = DEFAULTMAXLISTUSERS
             if mlu < 0: raise OverflowError
             un = getattr(aclu, 'user_names', _notfound)
             if un is not _notfound:
                 un = aclu.__of__(item).user_names # rewrap
                 unl = un()
                 # maxlistusers of 0 is list all
                 if len(unl) > mlu and mlu != 0:
                     raise OverflowError
                 for name in unl:
                     dict[name]=1
         item = getattr(item, 'aq_parent', _notfound)
         if item is _notfound:
             break
     keys=dict.keys()
     keys.sort()
     return tuple(keys)