aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMart Raudsepp <leio@gentoo.org>2016-09-24 10:01:30 +0300
committerMart Raudsepp <leio@gentoo.org>2016-09-24 10:01:30 +0300
commit6113941adc9693cac0a4aa12cdac82f75c7921bd (patch)
tree63c29779b071f166589d37927a4ab869be559b58 /backend
parentAdd syncing of packages in categories from packages.g.o (just name) (diff)
downloadgrumpy-6113941adc9693cac0a4aa12cdac82f75c7921bd.tar.gz
grumpy-6113941adc9693cac0a4aa12cdac82f75c7921bd.tar.bz2
grumpy-6113941adc9693cac0a4aa12cdac82f75c7921bd.zip
Add a full_name property to package and remove some debug spam on sync
Diffstat (limited to 'backend')
-rw-r--r--backend/lib/models.py4
-rw-r--r--backend/lib/sync.py1
2 files changed, 4 insertions, 1 deletions
diff --git a/backend/lib/models.py b/backend/lib/models.py
index 8e47d56..8f7637d 100644
--- a/backend/lib/models.py
+++ b/backend/lib/models.py
@@ -15,6 +15,10 @@ class Package(db.Model):
category_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=False)
category = db.relationship('Category', backref=db.backref('packages', lazy='dynamic'))
+ @property
+ def full_name(self):
+ return "%s/%s" % (self.category.name, self.name)
+
def __repr__(self):
return "<Package '%s/%s'>" % (self.category.name, self.name)
diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index 6dcb6b9..a6aef23 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -26,7 +26,6 @@ def sync_categories():
def sync_packages():
for category in Category.query.all():
existing_packages = category.packages.all()
- print("Existing packages in DB for category %s: %s" % (category.name, existing_packages,))
data = http_session.get(url_base + "categories/" + category.name + ".json")
if not data:
print("No JSON data for category %s" % category.name) # FIXME: Better handling; mark category as inactive/gone?