def assemble(self, login_bookmark=None, get_queues=None): self.get_queues = get_queues self.web_session = ExecutionContext.get_context().session self.first_log_in = ViewPreCondition( LoginSession.for_current_session().is_logged_in, exception=Detour(login_bookmark)) self.workflow_interface = WorkflowInterface() self.inbox = Inbox(self.get_queues()) inbox_view_factory = self.define_view('/', title=_('Inbox')) inbox_view_factory.set_slot('main_slot', InboxWidget.factory(self.inbox)) task_view_factory = self.define_view('/task', view_class=TaskView, task=PersistedField( Task, required=True)) task_view_factory.add_precondition(self.first_log_in) inbox_view_factory.add_precondition(self.first_log_in) self.define_transition(self.workflow_interface.events.take_task, inbox_view_factory, task_view_factory) self.define_transition(self.workflow_interface.events.go_to_task, inbox_view_factory, task_view_factory) self.define_transition(self.workflow_interface.events.defer_task, task_view_factory, inbox_view_factory) self.define_transition(self.workflow_interface.events.release_task, task_view_factory, inbox_view_factory)
def assemble(self): viewa = self.define_view('/viewa', title='View a') explicit_return_view = self.define_view('/explicitReturnView', title='Explicit Return View') default = self.define_view('/defaultReturnView', title='Default view to return to') detour = self.define_view('/detour', title='Detour') viewa.add_precondition(ViewPreCondition(lambda: False, exception=Detour(detour.as_bookmark(self), return_to=explicit_return_view.as_bookmark(self)))) detour.add_precondition(ViewPreCondition(lambda: False, exception=Return(default.as_bookmark(self))))
def assemble(self): event = Event(label='Click me') event.bind('anevent', None) viewa = self.define_view('/viewa', title='View a') explicit_return_view = self.define_view('/explicitReturnView', title='Explicit Return View') detour = self.define_view('/detour', title='Detour') detour.set_slot('main', FormWithButton.factory(event)) viewa.add_precondition(ViewPreCondition(lambda: False, exception=Detour(detour.as_bookmark(self), return_to=explicit_return_view.as_bookmark(self)))) self.define_return_transition(event, detour)
def assemble(self): event = Event(label='Click me') event.bind('anevent', None) viewa = self.define_view('/viewa', title='View a') step1 = self.define_view('/firstStepOfDetour', title='Step 1') step1.set_slot('main', FormWithButton.factory(event)) step2 = self.define_view('/lastStepOfDetour', title='Step 2') step2.set_slot('main', FormWithButton.factory(event)) viewa.add_precondition( ViewPreCondition(lambda: fixture.make_precondition_pass, exception=Detour(step1.as_bookmark(self)))) self.define_transition(event, step1, step2) self.define_return_transition(event, step2)