예제 #1
0
 def register(content_type):
     workflow = Workflow(self.state_attr, self.initial_state,
                         self.permission_checker, self.name,
                         self.description)
     for state in self.states:
         try:
             workflow.add_state(state.name,
                                state.callback,
                                aliases=state.aliases,
                                **state.extras)
         except WorkflowError, why:
             raise ConfigurationError(str(why))
예제 #2
0
        def register(content_type):
            workflow = Workflow(self.state_attr, self.initial_state,
                                self.permission_checker, self.name,
                                self.description)
            for state in self.states:
                try:
                    workflow.add_state(state.name,
                                       state.callback,
                                       aliases=state.aliases,
                                       **state.extras)
                except WorkflowError as why:
                    raise ConfigurationError(str(why))

            for transition in self.transitions:
                try:
                    workflow.add_transition(transition.name,
                                            transition.from_state,
                                            transition.to_state,
                                            transition.callback,
                                            transition.permission,
                                            **transition.extras)
                except WorkflowError as why:
                    raise ConfigurationError(str(why))

            try:
                workflow.check()
            except WorkflowError as why:
                raise ConfigurationError(str(why))

            register_workflow(workflow, self.type, content_type,
                              self.elector, self.info)
예제 #3
0
        def register(content_type):
            workflow = Workflow(self.state_attr, self.initial_state,
                                self.permission_checker, self.name,
                                self.description)
            for state in self.states:
                try:
                    workflow.add_state(state.name,
                                       state.callback,
                                       aliases=state.aliases,
                                       title=state.title,
                                       **state.extras)
                except WorkflowError as why:
                    raise ConfigurationError(str(why))

            for transition in self.transitions:
                try:
                    workflow.add_transition(transition.name,
                                            transition.from_state,
                                            transition.to_state,
                                            transition.callback,
                                            transition.permission,
                                            transition.title,
                                            guards=transition.guards,
                                            **transition.extras)
                except WorkflowError as why:
                    raise ConfigurationError(str(why))

            try:
                workflow.check()
            except WorkflowError as why:
                raise ConfigurationError(str(why))

            register_workflow(workflow, self.type, content_type,
                              self.elector, self.info)