Ejemplo n.º 1
0
 def get_by_id(self, id):
     return IdeaData.get(id)
 def get_by_id(self, id):
     return IdeaData.get(id)
Ejemplo n.º 3
0
    def create(self, title, description, impact, submitted_by, domain,
               challenge=None, tags=None, submission_date=None, **kw):
        # FIXME: this code should be the default constructor of the IdeaData
        idea = IdeaData(**kw)
        idea.title = title
        idea.description = description
        idea.impact = impact
        idea.submitted_by = submitted_by
        idea.domain = domain
        idea.challenge = challenge
        idea.tags = tags or []
        idea.submission_date = submission_date or datetime.now()
        idea.authors = [submitted_by]  # at least

        # initialize a workflow context
        #  FIXME: this code should be the default constructor of the IdeaWFContextData
        initial_state = StateData.get_by(
            label=get_workflow().WFStates.INITIAL_STATE)
        idea.wf_context = IdeaWFContextData()
        idea.wf_context.state = initial_state

        # initialize an evaluation context
        # FIXME: should be initialized at the moment when the idea is submitted (i.e. enters in the workflow...)
        idea.eval_context = IdeaEvalContextData()
        idea.eval_context.title = title
        idea.eval_context.description = description
        idea.eval_context.impact = impact

        return idea
    def create(self,
               title,
               description,
               impact,
               submitted_by,
               domain,
               challenge=None,
               tags=None,
               submission_date=None,
               **kw):
        # FIXME: this code should be the default constructor of the IdeaData
        idea = IdeaData(**kw)
        idea.title = title
        idea.description = description
        idea.impact = impact
        idea.submitted_by = submitted_by
        idea.domain = domain
        idea.challenge = challenge
        idea.tags = tags or []
        idea.submission_date = submission_date or datetime.now()
        idea.authors = [submitted_by]  # at least

        # initialize a workflow context
        #  FIXME: this code should be the default constructor of the IdeaWFContextData
        initial_state = StateData.get_by(
            label=get_workflow().WFStates.INITIAL_STATE)
        idea.wf_context = IdeaWFContextData()
        idea.wf_context.state = initial_state

        # initialize an evaluation context
        # FIXME: should be initialized at the moment when the idea is submitted (i.e. enters in the workflow...)
        idea.eval_context = IdeaEvalContextData()
        idea.eval_context.title = title
        idea.eval_context.description = description
        idea.eval_context.impact = impact

        return idea