def do_get(self, req, args): """ Perform a get for the given ticket id, or all the tickets if no id is provided. """ ticket_id = args.get('id') command = None if ticket_id: command = TicketController.GetTicketCommand(self.env, ticket=ticket_id) command.native = True else: # Now artificially limited to 20 to avoid explosion # TODO: support paging here command = TicketController.ListTicketsCommand(self.env, limit=20) result = TicketController(self.env).process_command(command) # AT: really needed? assert result != None if not isinstance(result, list): result = [result] # send the serialized list back ticket_module = AgiloTicketModule(self.env) return [ ticket_module.ticket_as_json(req, ticket.id) for ticket in result ]
def backlog_as_json(self, req, name, scope): from agilo.ticket.web_ui import AgiloTicketModule ticket_module = AgiloTicketModule(self.env) json_data = [] backlog = self._get_backlog(name, scope) for backlog_item in backlog: ticket_dict = ticket_module.ticket_as_json(req, backlog_item.ticket) json_data.append(ticket_dict) return json_data
def backlog_as_json(self, req, name, scope): from agilo.ticket.web_ui import AgiloTicketModule ticket_module = AgiloTicketModule(self.env) json_data = [] backlog = self._get_backlog(name, scope) for backlog_item in backlog: ticket_dict = ticket_module.ticket_as_json(req, backlog_item.ticket) json_data.append(ticket_dict) return json_data
def do_get(self, req, args): """ Perform a get for the given ticket id, or all the tickets if no id is provided. """ ticket_id = args.get('id') command = None if ticket_id: command = TicketController.GetTicketCommand(self.env, ticket=ticket_id) command.native = True else: # Now artificially limited to 20 to avoid explosion # TODO: support paging here command = TicketController.ListTicketsCommand(self.env, limit=20) result = TicketController(self.env).process_command(command) # AT: really needed? assert result != None if not isinstance(result, list): result = [result] # send the serialized list back ticket_module = AgiloTicketModule(self.env) return [ticket_module.ticket_as_json(req, ticket.id) for ticket in result]