Exemplo n.º 1
0
    def _update_post_stats(self, key, attitude=None, *largs, **kwargs):
        if attitude:

            def update(ds):
                ds[key] = attitude

            attitude_ds.update(update)
            if attitude == 'like':

                def add_fav(ds):
                    ds.add(key)

                favorites_ds.update(add_fav)
            else:  ##elif attitude == 'dislike':

                def remove_fav(ds):
                    if key in ds:
                        ds.remove(key)

                def remove_fav_data(ds):
                    if key in ds:
                        del ds[key]

                favorites_ds.update(remove_fav)
                favs_data_ds.update(remove_fav_data)
        if self.container:
            post = self.container.get_widget(key)
            if post:
                post.update_widget_data(kwargs)
        self.dispatch('on_post_updated', key, kwargs)
Exemplo n.º 2
0
 def _update_comment_stats(self, key, attitude=None, **kwargs):
     if attitude:
         def update(ds):
             ds[key] = attitude
         attitude_ds.update(update)
     if self.comments_container:
         comment = self.comments_container.get_widget(key)
         if comment:
             comment.update_widget_data(kwargs)
Exemplo n.º 3
0
    def _update_comment_stats(self, key, attitude=None, **kwargs):
        if attitude:

            def update(ds):
                ds[key] = attitude

            attitude_ds.update(update)
        if self.comments_container:
            comment = self.comments_container.get_widget(key)
            if comment:
                comment.update_widget_data(kwargs)
Exemplo n.º 4
0
 def _update_post_stats(self, key, attitude=None, *largs, **kwargs):
     if attitude:
         def update(ds):
             ds[key] = attitude
         attitude_ds.update(update)
         if attitude == 'like':
             def add_fav(ds):
                 ds.add(key)
             favorites_ds.update(add_fav)
         else: ##elif attitude == 'dislike':
             def remove_fav(ds):
                 if key in ds:
                     ds.remove(key)
             def remove_fav_data(ds):
                 if key in ds:
                     del ds[key]
             favorites_ds.update(remove_fav)
             favs_data_ds.update(remove_fav_data)
     if self.container:
         post = self.container.get_widget(key)
         if post:
             post.update_widget_data(kwargs)
     self.dispatch('on_post_updated', key, kwargs)