Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Update insert columns. Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aandis authored and chadwhitacre committed Dec 16, 2016
1 parent edcdf81 commit aff52c8
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions gratipay/models/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,21 @@ def _from_thing(cls, thing, value):
@classmethod
def insert(cls, owner, **fields):
return cls.db.one("""
INSERT INTO packages
(package_manager_id, name, description,
long_description, long_description_raw,
long_description_type)
VALUES (%(package_manager_id)s, %(name)s, %(description)s,
%(long_description)s, %(long_description_raw)s,
%(long_description_type)s)
INSERT INTO packages (package_manager, name, description, emails)
VALUES (%(package_manager)s, %(name)s, %(description)s, %(emails)s)
RETURNING packages.*::packages
""", fields)

def set_team(self, team):
""" Set team for a package.
"""Set team for a package.
"""
if not isinstance(team, Team):
raise NotAllowed("Not a team!")
elif team.is_closed:
raise NotAllowed("team is closed")
elif not team.is_approved:
raise NotAllowed("team not approved")

package_id = self.id
slug = team.slug
with self.db.get_cursor() as c:
Expand Down

0 comments on commit aff52c8

Please sign in to comment.