def add_contingent_to_sprint(self, name, amount, sprint): # REFACT: why can't I say sprint.add_contingent('Foo', 12). That would seem so much nicer? # Maybe sprint.contingents.add('foo', 12) to have an easier time to separate stuff out. # That could also support stuff like {{{for contingent in sprint.contingents: ...}}} add_contingent_command = ContingentController.AddContingentCommand( self.env, sprint=sprint, name=name, amount=str(amount)) ContingentController(self.env).process_command(add_contingent_command)
def do_post(self, req): req.perm.assert_permission(Action.CONTINGENT_ADMIN) name = req.args.get('cont_name') amount = req.args.get('cont_amount') sprint = self._get_sprint(req) params = dict(sprint=sprint.name, name=name, amount=amount) try: cmd = ContingentController.AddContingentCommand(self.env, **params) ContingentController(self.env).process_command(cmd) except Exception, e: raise TracError(exception_to_unicode(e))
def _create_contingent(self, contingent_name, sprint, amount): self._clear_model_cache() cmd = ContingentController.AddContingentCommand(self.env, name=contingent_name, sprint=sprint.name, amount=str(amount)) ContingentController(self.env).process_command(cmd) return self._get_contingent(contingent_name, sprint)
def _create_contingent(self): self._clear_model_cache() cmd = ContingentController.AddContingentCommand( self.env, name=self.support, sprint=self.sprint.name, amount='20') ContingentController(self.env).process_command(cmd) return self._contingent()