diff options
Diffstat (limited to 'Tools/QueueStatusServer/model/workitems.py')
-rw-r--r-- | Tools/QueueStatusServer/model/workitems.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Tools/QueueStatusServer/model/workitems.py b/Tools/QueueStatusServer/model/workitems.py index 772fc39..b74f5f5 100644 --- a/Tools/QueueStatusServer/model/workitems.py +++ b/Tools/QueueStatusServer/model/workitems.py @@ -36,6 +36,14 @@ class WorkItems(db.Model, QueuePropertyMixin): item_ids = db.ListProperty(int) date = db.DateTimeProperty(auto_now_add=True) + @classmethod + def key_for_queue(cls, queue_name): + return "work-items-%s" % (queue_name) + + @classmethod + def lookup_by_queue(cls, queue_name): + return cls.get_or_insert(key_name=cls.key_for_queue(queue_name), queue_name=queue_name) + def display_position_for_attachment(self, attachment_id): """Returns a 1-based index corresponding to the position of the attachment_id in the queue. If the attachment is |