Пример #1
0
 def get_owner_last_commons(startKey=None, endKey=None,
              skip=0, limit=COMMON_LIMIT, tag=None):
     '''
     Returns owner commons. If *startKey* is provided, it returns last
     common posted by owner until *startKey*.
     '''
     return DocumentManager.get_tagged_documents(Common, "commons/owner",
         "commons/mine-tags", startKey, endKey, tag, limit, skip)
Пример #2
0
    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)
Пример #3
0
    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])
Пример #4
0
 def get_owner_last_pictures(startKey=None, endKey=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, endKey, tag, limit, skip)
Пример #5
0
    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)
Пример #6
0
 def get_last_commons(startKey=None,
                      endKey=None,
                      skip=0,
                      limit=COMMON_LIMIT,
                      tag=None):
     '''
     Returns all commons. If *startKey* is provided, it returns last
     common posted until *startKey*.
     '''
     return DocumentManager.get_tagged_documents(Common, "commons/last",
                                                 "commons/tags", startKey,
                                                 endKey, tag, limit, skip)
Пример #7
0
    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)
Пример #8
0
    def get_mine(startKey=None, endKey=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, endKey, tag, limit, skip)
Пример #9
0
    def get_list(startKey=None, endKey=None, skip=0,
                limit=news_settings.NEWS_LIMIT, tag=None):
        '''
        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_tagged_documents(MicroPost,
                "news/all", "news/tags", startKey, endKey, tag, limit, skip)
Пример #10
0
 def get_common_micropost(commonId):
     '''
     Get micropost by common to download key.
     '''
     return DocumentManager.get_document(
          MicroPost, "news/common", key=commonId)
Пример #11
0
 def get_picture_micropost(pictureId):
     '''
     Get picture by picture to download key.
     '''
     return DocumentManager.get_document(
          MicroPost, "news/picture", key=pictureId)
Пример #12
0
    def get_micropost(mid):
        '''
        Returns post of which id match given *id*.
        '''

        return DocumentManager.get_document(MicroPost, "news/full", mid)