Пример #1
0
def submit_post(d=post1):
    it = incoming.find_or_insert_posts([d], None, 
        lambda x:core.GplusPersonData(x, insertNew='findOrInsert').parent,
        lambda x:x['content'], lambda x:x['user'], lambda x:0,
        lambda x:x['id'], lambda x:datetime.now(),
        lambda x:False, 'gplusPost')
    return list(it)
Пример #2
0
 def find_or_insert_posts(self, posts,
                          get_content=lambda x:x['object']['content'],
                          get_user=lambda x:x['actor']['id'],
                          get_replycount=lambda x:
                          x['object']['replies']['totalItems'],
                          get_id=lambda x:x['id'],
                          get_timestamp=get_gplus_timestamp,
                          recentEvents=None):
     'save google+ posts to core.find_or_insert_posts()'
     import core
     return find_or_insert_posts(posts, self.get_post_comments,
                                 lambda x:core.GplusPersonData(x,
                            insertNew='findOrInsert').parent,
                                 get_content, get_user, get_replycount,
                                 get_id, get_timestamp, 'gplusPost',
                                 convert_timestamps, convert_timestamps,
                                 recentEvents=recentEvents)
Пример #3
0
 def find_or_insert_posts(
         self,
         posts,
         get_content=lambda x: x['object']['content'],
         get_user=lambda x: x['actor']['id'],
         get_replycount=lambda x: x['object']['replies']['totalItems'],
         get_id=lambda x: x['id'],
         get_timestamp=get_gplus_timestamp,
         is_reshare=lambda x: x['object']['objectType'] == 'activity' and x[
             'object'].get('id', False),
         **kwargs):
     'save google+ posts to core.find_or_insert_posts()'
     import core
     return find_or_insert_posts(
         posts, self.get_post_comments,
         lambda x: core.GplusPersonData(x, insertNew='findOrInsert').parent,
         get_content, get_user, get_replycount, get_id, get_timestamp,
         is_reshare, 'gplusPost', convert_timestamps, convert_timestamps,
         **kwargs)
Пример #4
0
 def find_or_insert_posts(self, posts,
                          get_content=lambda x:x['object']['content'],
                          get_user=lambda x:x['actor']['id'],
                          get_replycount=lambda x:
                          x['object']['replies']['totalItems'],
                          get_id=lambda x:x['id'],
                          get_timestamp=get_gplus_timestamp,
                          is_reshare=lambda x: 
                          x['object']['objectType'] == 'activity' and
                          x['object'].get('id', False),
                          **kwargs):
     'save google+ posts to core.find_or_insert_posts()'
     import core
     return find_or_insert_posts(posts, self.get_post_comments,
                                 lambda x:core.GplusPersonData(x,
                            insertNew='findOrInsert').parent,
                                 get_content, get_user, get_replycount,
                                 get_id, get_timestamp, is_reshare, 'gplusPost',
                                 convert_timestamps, convert_timestamps,
                                 **kwargs)