[Pkg-debile-commits] [debile-master] 59/126: update models

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:56:14 UTC 2013


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch scan-build-html
in repository debile-master.

commit b9b8e61d0491f60cdb19389d3020a2a366dc5690
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Sat Jun 1 21:37:04 2013 -0400

    update models
---
 lucy/models/machine.py |    3 +++
 lucy/models/source.py  |    5 +++++
 lucy/models/user.py    |    4 ++++
 3 files changed, 12 insertions(+)

diff --git a/lucy/models/machine.py b/lucy/models/machine.py
index aefc997..7bf7e2f 100644
--- a/lucy/models/machine.py
+++ b/lucy/models/machine.py
@@ -22,6 +22,9 @@ class Machine(LucyObject):
     def get_by_key(cls, key):
         return cls.single({"gpg": key})
 
+    def get_owner(self):
+        return User.load(self['owner'])
+
     def ping(self):
         self['last_ping'] = dt.datetime.utcnow()
         self.save()
diff --git a/lucy/models/source.py b/lucy/models/source.py
index 68f0fce..0cda65f 100644
--- a/lucy/models/source.py
+++ b/lucy/models/source.py
@@ -42,3 +42,8 @@ class Source(LucyObject):
             "finished_at": None
         }).count()
         return (total, unfinished)
+
+    @classmethod
+    def get_uploads_for_user(cls, who):
+        for x in cls.query({"owner": who}):
+            yield x
diff --git a/lucy/models/user.py b/lucy/models/user.py
index 2c2f2b8..f2e2afe 100644
--- a/lucy/models/user.py
+++ b/lucy/models/user.py
@@ -19,4 +19,8 @@ class User(LucyObject):
     def get_by_key(cls, key):
         return cls.single({"gpg": key})
 
+    def get_uploads(self):
+        from lucy import Source
+        return Source.get_uploads_for_user(self['_id'])
+
     get_by_uid = LucyObject.load

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git



More information about the Pkg-debile-commits mailing list