Example #1
0
 def _getAnswer(self):
     if self._categ is conference.CategoryManager().getRoot():
         raise ServiceError('ERR-U0', _('Cannot add root category as favorite'))
     self._avatar.linkTo(self._categ, 'favorite')
     if redis_write_client:
         suggestions.unignore(self._avatar, 'category', self._categ.getId())
         suggestions.unsuggest(self._avatar, 'category', self._categ.getId())
Example #2
0
 def _process_PUT(self):
     if self.category not in self.user.favorite_categories:
         if not self.category.can_access(self.user):
             raise Forbidden()
         self.user.favorite_categories.add(self.category)
         if redis_write_client:
             suggestions.unignore(self.user, 'category', str(self.category.id))
             suggestions.unsuggest(self.user, 'category', str(self.category.id))
     return jsonify(success=True)
Example #3
0
 def _getAnswer(self):
     if self._categ is conference.CategoryManager().getRoot():
         raise ServiceError('ERR-U0',
                            _('Cannot add root category as favorite'))
     self._avatar.linkTo(self._categ, 'favorite')
     if redis_write_client:
         suggestions.unignore(self._avatar, 'category', self._categ.getId())
         suggestions.unsuggest(self._avatar, 'category',
                               self._categ.getId())
Example #4
0
 def _process_PUT(self):
     category = CategoryManager().getById(request.view_args['category_id'])
     if category not in self.user.favorite_categories:
         if not category.canAccess(AccessWrapper(self.user.as_avatar)):
             raise Forbidden()
         self.user.favorite_categories.add(category)
         if redis_write_client:
             suggestions.unignore(self.user, 'category', category.getId())
             suggestions.unsuggest(self.user, 'category', category.getId())
     return jsonify(success=True)
Example #5
0
 def _process_PUT(self):
     category = CategoryManager().getById(request.view_args['category_id'])
     if category not in self.user.favorite_categories:
         if not category.canAccess(AccessWrapper(self.user.as_avatar)):
             raise Forbidden()
         self.user.favorite_categories.add(category)
         if redis_write_client:
             suggestions.unignore(self.user, 'category', category.getId())
             suggestions.unsuggest(self.user, 'category', category.getId())
     return jsonify(success=True)