コード例 #1
0
ファイル: models.py プロジェクト: DopeChicCity/newebe
 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
ファイル: models.py プロジェクト: DopeChicCity/newebe
    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
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
    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
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
    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
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
    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
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
    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
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
 def get_common_micropost(commonId):
     '''
     Get micropost by common to download key.
     '''
     return DocumentManager.get_document(
          MicroPost, "news/common", key=commonId)
コード例 #11
0
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
 def get_picture_micropost(pictureId):
     '''
     Get picture by picture to download key.
     '''
     return DocumentManager.get_document(
          MicroPost, "news/picture", key=pictureId)
コード例 #12
0
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
    def get_micropost(mid):
        '''
        Returns post of which id match given *id*.
        '''

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