Exemplo n.º 1
0
 def add_public_key(self, description, data):
     PublicKey = meta.get_model('PublicKey')
     key = PublicKey(owner=self,
                     description=unicode(description),
                     data=unicode(data))
     key.save()
     self.update_authorized_keys()
     return key
Exemplo n.º 2
0
    def create_repository(self, name, description):
        GitRepository = meta.get_model('GitRepository')

        title = unicode(name)
        repo = GitRepository.create(
            name=title,
            slug=slugify(title),
            description=unicode(description),
            owner=self
        )

        return repo
Exemplo n.º 3
0
 def total_of_keys(self):
     cls = meta.get_model('PublicKey')
     session = meta.get_session()
     total = session.query(cls).filter_by(owner=self).count()
     return total
Exemplo n.º 4
0
 def total_of_repositories(self):
     cls = meta.get_model('GitRepository')
     session = meta.get_session()
     total = session.query(cls).filter_by(owner=self).count()
     return total