示例#1
0
 def __str__(self):
     tabs_utility = getUtility(IWorkspaceTabsUtility)
     domain_class = self.context.__class__
     status = self.context.status
     principal = get_principal()
     roles = get_principal_roles(principal)
     for role in roles:
         tab = tabs_utility.getTab(role, domain_class, status)
         if tab:
             break
     if tab:
         base_url = ui_utils.url.absoluteURL(getSite(), self.request)
         key = workspace.stringKey(self.context)
         return '%s/workspace/documents/%s/%s' % (base_url, tab, key)
     else:
         return None
示例#2
0
 def _query( self ):
     principal = get_principal()
     roles = get_principal_roles(principal)
     #Add bungeni.Owner to the roles
     roles.append("bungeni.Owner")
     workspace_tabs = component.getUtility(IWorkspaceTabsUtility)
     domain_status = {}
     for role in roles:
         dom_stat = workspace_tabs.getDomainAndStatuses(role, self.__name__)
         if dom_stat:
             for key in dom_stat.keys():
                 if key in domain_status.keys():
                     domain_status[key].extend(dom_stat[key])
                 else:
                     domain_status[key] = dom_stat[key]    
     session = Session()
     results = []
     for domain_class in domain_status.keys():
         query = session.query(domain_class).filter(
                        domain_class.status.in_(domain_status[domain_class]))
         results.extend(query.all())
     results.sort(key = lambda x: x.status_date, reverse=True)
     for result in results:
         yield result
示例#3
0
 def _query(self):
     principal = get_principal()
     roles = get_principal_roles(principal)
     #Add bungeni.Owner to the roles
     roles.append("bungeni.Owner")
     workspace_tabs = component.getUtility(IWorkspaceTabsUtility)
     domain_status = {}
     for role in roles:
         dom_stat = workspace_tabs.getDomainAndStatuses(role, self.__name__)
         if dom_stat:
             for key in dom_stat.keys():
                 if key in domain_status.keys():
                     domain_status[key].extend(dom_stat[key])
                 else:
                     domain_status[key] = dom_stat[key]
     session = Session()
     results = []
     for domain_class in domain_status.keys():
         query = session.query(domain_class).filter(
             domain_class.status.in_(domain_status[domain_class]))
         results.extend(query.all())
     results.sort(key=lambda x: x.status_date, reverse=True)
     for result in results:
         yield result