This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baf8248
commit 404107c
Showing
10 changed files
with
316 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
|
||
class Package(object): | ||
"""A :py:class:`~gratipay.models.team.Team` can be associated with :py:class:`Package`. | ||
""" | ||
|
||
@property | ||
def package(self): | ||
"""A computed attribute, the | ||
:py:class:`~gratipay.models.package.Package` linked to this team if | ||
there is one, otherwise ``None``. Makes a database call. | ||
""" | ||
return self.load_package(self.db) | ||
|
||
|
||
def load_package(self, cursor): | ||
"""Given a database cursor, return a | ||
:py:class:`~gratipay.models.package.Package` if there is one linked to | ||
this package, or ``None`` if not. | ||
""" | ||
return cursor.one('SELECT p.*::packages FROM packages p WHERE p.team_id=%s', (self.id,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.