Beispiel #1
0
 def group(self):
     parent = self.context.__parent__
     while parent is not None:
         if IBungeniGroup.providedBy(parent):
             return parent
         parent = parent.__parent__
     return None
     raise ValueError("Unable to locate application.")
 def __call__(self, context):
     terms = []
     while not IBungeniGroup.providedBy(context):
         context = context.__parent__
         if not context:
             raise NotImplementedError("Context does not implement IBungeniGroup")
     trusted = removeSecurityProxy(context)
     role = getUtility(IRole, get_group_local_role(trusted))
     for sub_role in ISubRoleAnnotations(role).sub_roles:
         print sub_role
         terms.append(vocabulary.SimpleTerm(sub_role, sub_role, sub_role))
     return vocabulary.SimpleVocabulary(terms)
Beispiel #3
0
 def __call__(self, context):
     terms = []
     while not IBungeniGroup.providedBy(context):
         context = context.__parent__
         if not context:
             raise NotImplementedError(
                 "Context does not implement IBungeniGroup")
     trusted = removeSecurityProxy(context)
     role = getUtility(IRole, get_group_local_role(trusted))
     for sub_role in ISubRoleAnnotations(role).sub_roles:
         print sub_role
         terms.append(vocabulary.SimpleTerm(sub_role, sub_role, sub_role))
     return vocabulary.SimpleVocabulary(terms)
Beispiel #4
0
 def func(context):
     if IBungeniGroup.providedBy(parent_container_or_getter):
         parent_container = parent_container_or_getter
     else:
         parent_container = parent_container_or_getter(context)
     #
     try:
         c = getattr(parent_container, name)
     except AttributeError:
         # the container we need is not there, data may be missing in the db
         from zope.publisher.interfaces import NotFound
         raise NotFound(context, name)
     c.setQueryModifier(sql.and_(c.getQueryModifier(), query_modifier))
     return c
Beispiel #5
0
 def func(context):
     if IBungeniGroup.providedBy(parent_container_or_getter):
         parent_container = parent_container_or_getter
     else:
         parent_container = parent_container_or_getter(context)
     #
     try:
         c = getattr(parent_container, name)
     except AttributeError:
         # the container we need is not there, data may be missing in the db
         from zope.publisher.interfaces import NotFound
         raise NotFound(context, name)
     c.setQueryModifier(sql.and_(c.getQueryModifier(), query_modifier))
     return c
 def __call__(self, context=None):
     while not IBungeniGroup.providedBy(context):
         context = context.__parent__
         if not context:
             raise NotImplementedError("Context does not implement IBungeniGroup")
     query = self.constructQuery(context)
     results = query.all()
     terms = []
     for ob in results:
         obj = translate_obj(ob)
         terms.append(vocabulary.SimpleTerm(
                 value = obj.title_type_id, 
                 token = obj.title_type_id,
                 title = obj.title_name,
             ))
     return vocabulary.SimpleVocabulary(terms)
Beispiel #7
0
 def __call__(self, context=None):
     while not IBungeniGroup.providedBy(context):
         context = context.__parent__
         if not context:
             raise NotImplementedError(
                 "Context does not implement IBungeniGroup")
     query = self.constructQuery(context)
     results = query.all()
     terms = []
     for ob in results:
         obj = translate_obj(ob)
         terms.append(
             vocabulary.SimpleTerm(
                 value=obj.title_type_id,
                 token=obj.title_type_id,
                 title=obj.title_name,
             ))
     return vocabulary.SimpleVocabulary(terms)