Exemple #1
0
            'pk': self.id,
            'id': self.id,
            'slug': self.slug,
            'name': self.name,
            'status': self.status,
            'description': self.description,
            'reporter': self.reporter,
            'owner': self.owner,
            'type': self.type,
            'project': self.project.id,
        }
    
    def yaml(self):
        return "\n".join([
            "# %s ticket %s" % (self.project.name, self.id),
            "%-11s%s" % ("slug:", self.slug),
            "%-11s%s" % ("name:", self.name),
            "%-11s%s" % ("type:", self.type),
            "%-11s%s" % ("status:", self.status),
            "%-11s%s" % ("owner:", self.owner),
            "%-11s%s" % ("reporter:", self.reporter),
            "description: ",
            "    %s" % self.description,
        ])

# Mapping
from tables import tickets_table, mapper, relation

mapper(Ticket, tickets_table, properties={
    'project': relation(Project, backref='tickets')
})
Exemple #2
0
        from ticket import Ticket
        return self.session.query(Ticket).filter_by(project=self).filter_by(slug=id).first()
    
    def get_tickets(self):
        from ticket import Ticket
        return self.session.query(Ticket)
    
    @property
    def settings(self):
        return {
            'state_default': 'open',
            'state_closed': 'closed',
            'states': [
                'open',
                'invalid',
                'wontfix',
                'closed',
            ],
            'type_default': 'story',
            'types': [
                'story',
                'task',
                'bug',
                'chore'
            ],
        }

# Mapping
from tables import projects_table, mapper
mapper(Project, projects_table)