def getSchedulingContexts(self, request): """Set up scheduling contexts. Currently we include: - committees - plenary """ contexts = [] app = getSite() today = datetime.date.today() check_permissions = False #!+HARDWIRING(mb, Aug-2012) unhardwire committees lookup if interfaces.IWorkspaceSchedulingSectionLayer.providedBy(request): committees = app["workspace"]["scheduling"]["committees"].values() check_permissions = True elif interfaces.IBusinessSectionLayer.providedBy(request): committees = app["business"]["committees"].values() else: committees = [] if check_permissions: for committee in committees: if ((committee.end_date is None or committee.end_date >= today) and (committee.start_date is None or committee.start_date <= today) and checkPermission("bungeni.agenda_item.Add", committee) and (committee.status == "active")): contexts.append( schedule.CommitteeSchedulingContext(committee)) else: for committee in committees: if ((committee.end_date is None or committee.end_date >= today) and (committee.start_date is None or committee.start_date <= today) and (committee.status == "active")): contexts.append( schedule.CommitteeSchedulingContext(committee)) for context in contexts: context.__name__ = u"schedule" #!+HARDWIRING(mb, Aug-2012) unhardwire committees lookup if interfaces.IWorkspaceSchedulingSectionLayer.providedBy(request): contexts.append( schedule.ISchedulingContext(app["workspace"]["scheduling"])) elif interfaces.IBusinessSectionLayer.providedBy(request): contexts.append( schedule.ISchedulingContext(app["business"]["sittings"])) if len(contexts): contexts[-1].__name__ = u"" return contexts
def getSchedulingContexts(self, request): """Set up scheduling contexts. Currently we include: - committees - plenary """ app = common.get_application() committees = [] contexts = [] # !+GENERALIZE_GROUP #!+HARDWIRING(mb, Aug-2012) unhardwire committees lookup if interfaces.IWorkspaceSchedulingSectionLayer.providedBy(request): committees[:] = app["workspace"]["scheduling"][ "committees"].values() for committee in committees: if committee.active: if capi.get_type_info(committee).workflow.has_feature( "sitting"): contexts.append(schedule.GroupSchedulingContext(committee)) for context in contexts: context.__name__ = u"schedule" if interfaces.IWorkspaceSchedulingSectionLayer.providedBy(request): contexts.append( schedule.ISchedulingContext(app["workspace"]["scheduling"])) if len(contexts): contexts[-1].__name__ = u"" return contexts
def getSchedulingContexts(self, request): """Set up scheduling contexts. Currently we include: - committees - plenary """ contexts = [] app = getSite() today = datetime.date.today() if interfaces.IWorkspaceSchedulingSectionLayer.providedBy(request): committees = app["workspace"]["scheduling"]["committees"].values() else: committees = app["business"]["committees"].values() user_id = get_db_user_id() for committee in committees: if user_id: if ((committee.end_date is None or committee.end_date >= today) and (committee.start_date is None or committee.start_date <= today) and checkPermission("bungeni.agendaitem.Add", committee) and (committee.status == "active")): contexts.append(schedule.CommitteeSchedulingContext( committee)) else: if ((committee.end_date is None or committee.end_date >= today) and (committee.start_date is None or committee.start_date <= today) and (committee.status == "active")): contexts.append(schedule.CommitteeSchedulingContext( committee)) for context in contexts: context.__name__ = u"schedule" if interfaces.IWorkspaceSchedulingSectionLayer.providedBy(request): contexts.append(schedule.ISchedulingContext( app["workspace"]["scheduling"])) else: contexts.append(schedule.ISchedulingContext( app["business"]["sittings"])) contexts[-1].__name__ = u"" return contexts