From aff52c87aad1e68f634780c1e91b8edad878ba6d Mon Sep 17 00:00:00 2001 From: aandis Date: Sun, 4 Dec 2016 22:22:43 +0530 Subject: [PATCH] Update insert columns. Cleanup --- gratipay/models/package/__init__.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/gratipay/models/package/__init__.py b/gratipay/models/package/__init__.py index 4b96fe449a..bc811a1a2f 100644 --- a/gratipay/models/package/__init__.py +++ b/gratipay/models/package/__init__.py @@ -47,20 +47,14 @@ 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!") @@ -68,7 +62,6 @@ def set_team(self, team): 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: