def get_owner_last_pictures(startKey=None, endKey=None, skip=0, limit=PICTURE_LIMIT): """ Returns owner pictures. If *startKey* is provided, it returns last picture posted by owner until *startKey*. """ return DocumentManager.get_documents(Picture, "pictures/owner", startKey, endKey, skip, limit)
def get_contact_micropost(contactKey, date): ''' Returns all micropost posted by a given contact. Contact key is used to retrieve the microposts. ''' return DocumentManager.get_document( MicroPost, "news/contact", key=[contactKey, date])
def get_mine(startKey=None, tag=None): ''' Return last 30 activities of newebe owner. If *startKey* (date) is given, last 30 activities until *startKey* will be returned. ''' return DocumentManager.get_documents(Activity, "activities/mine", startKey = startKey, limit = activity_settings.LIMIT + 1)
def get_owner_last_pictures(startKey=None, skip=0, limit=PICTURE_LIMIT, tag=None): ''' Returns owner pictures. If *startKey* is provided, it returns last picture posted by owner until *startKey*. ''' return DocumentManager.get_tagged_documents(Picture, "pictures/owner", "pictures/mine-tags", startKey, tag, limit, skip)
def get_first(dateKey): ''' Return first micro post written by current user from the list of micro posts corresponding to given date. Normally there should be only one post for this date, so the list should have only one element. Date format is set in news_settings.DB_DATE_FORMAT. Arguments: *date* Date used to retrieve micro post. ''' return DocumentManager.get_document(MicroPost, "news/all", dateKey)
def get_list(startKey=None, skip=0, limit=news_settings.NEWS_LIMIT): ''' Return last 10 (=NEWS_LIMIT in news_settings.py) micro posts descending. If *startKey* is given, it retrieves micro posts from startKey. Ex: If you need post from November, 2nd 2010, set *startKey* as 2010-11-02T23:59:00Z. First element is never included (because of pagination). Arguments: *startKey* The date from where data should be retrieved ''' return DocumentManager.get_documents( MicroPost, "news/all", startKey, skip, limit)
def get_mine(startKey=None, skip=0, limit=news_settings.NEWS_LIMIT, tag=None): ''' Return last 10 (=NEWS_LIMIT in news_settings.py) micro posts descending from current user. If *startKey* is given, it retrieves micro posts from startKey. Ex: If you need post from November, 2nd 2010, set *startKey* as 2010-11-02T23:59:00Z. First element is never included (because of pagination). ''' return DocumentManager.get_tagged_documents(MicroPost, "news/mine", "news/mine-tags", startKey, tag, limit, skip)
def get_micropost(mid): ''' Returns post of which id match given *id*. ''' return DocumentManager.get_document(MicroPost, "news/full", mid)