add method for providing all track data for favorites

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3717 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-02-08 08:19:48 +00:00
parent 3918b8ebc7
commit d12dac7e37

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -40,13 +40,17 @@ class Favorites(object):
self.context = context
def list(self, person, sortKey=None):
for item in self.listTracks(person, sortKey):
yield item.taskId
def listTracks(self, person, sortKey=None):
if person is None:
return
personUid = util.getUidForObject(person)
if sortKey is None:
sortKey = lambda x: -x.timeStamp
for item in sorted(self.context.query(userName=personUid), key=sortKey):
yield item.taskId
yield item
def add(self, obj, person, data=None):
if None in (obj, person):