def app_states(self): app = ISchoolToolApplication(None) container = IRelationshipStateContainer(app) states = container.get(self.view.app_states_name, None) if states is None: return {} return states
def getVocabulary(self): app = ISchoolToolApplication(None) container = IRelationshipStateContainer(app) relationships = container.get(self.field.source) terms = [ zope.schema.vocabulary.SimpleTerm(state, token=state.__name__, title=state.title) for state in relationships.states.values() ] vocabulary = zope.schema.vocabulary.SimpleVocabulary(terms) return vocabulary
def __call__(self): if self.states_name is None: raise NotImplementedError() container = IRelationshipStateContainer(self.app) if self.states_name not in container: try: container[self.states_name] = self.create(self.states_title) self.populate(container[self.states_name]) except Exception, e: try: del container[self.states_name] except Exception: pass raise e
def states(self): if self.app_states_name is None: return None app = ISchoolToolApplication(None) container = IRelationshipStateContainer(app) return container.get(self.app_states_name, None)
def container(self): app = ISchoolToolApplication(None) return IRelationshipStateContainer(app)
def getAppContactStates(): app = ISchoolToolApplication(None) container = IRelationshipStateContainer(app) app_states = container['contact-relationship'] return app_states
def app_states(self, key): app = ISchoolToolApplication(None) states = IRelationshipStateContainer(app)[key] return states
def completed_state_codes(self): app = ISchoolToolApplication(None) states = IRelationshipStateContainer(app)['section-membership'] codes = [state.code for state in states if states.overlap(COMPLETED, state.active)] return codes