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)
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)
def _process_DELETE(self): category = CategoryManager().getById(request.view_args['category_id']) if category in self.user.favorite_categories: self.user.favorite_categories.remove(category) if redis_write_client: suggestions.unsuggest(self.user, 'category', category.getId()) return jsonify(success=True)
def _process_DELETE(self): category = CategoryManager().getById(request.view_args['category_id']) if category in self.user.favorite_categories: self.user.favorite_categories.remove(category) if redis_write_client: suggestions.unsuggest(self.user, 'category', category.getId()) return jsonify(success=True)
def get_excluded_categories(): """Get all excluded category IDs""" from indico_livesync.plugin import LiveSyncPlugin todo = {x['id'] for x in LiveSyncPlugin.settings.get('excluded_categories')} excluded = set() while todo: category_id = todo.pop() try: category = CategoryManager().getById(category_id) except KeyError: continue excluded.add(category.getId()) todo.update(category.subcategories) return excluded
## You should have received a copy of the GNU General Public License ## along with Indico;if not, see <http://www.gnu.org/licenses/>. from indico.core.db import DBMgr from MaKaC.webinterface import displayMgr from MaKaC.conference import CategoryManager logfile=open('./oldstyles','w') def changeCatStyle(cat): for subcat in cat.getSubCategoryList(): currentStyle=subcat.getDefaultStyle("meeting") subcat.setDefaultStyle("meeting", "lhcb_meeting") logfile.write("cat %s: %s"%(subcat.getId(), currentStyle)) changeCatStyle(subcat) for conf in cat.getConferenceList(): currentStyle=displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(conf).getDefaultStyle() displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(conf).setDefaultStyle("lhcb_meeting") logfile.write("\t\t\tconf %s: %s"%(conf.getId(), currentStyle)) dbm = DBMgr.getInstance() dbm.startRequest() cat=CategoryManager().getById('233') currentStyle=cat.getDefaultStyle("meeting") cat.setDefaultStyle("meeting", "lhcb_meeting") logfile.write("cat %s: %s"%(cat.getId(), currentStyle)) changeCatStyle(cat) dbm.endRequest()
from indico.core.db import DBMgr from MaKaC.webinterface import displayMgr from MaKaC.conference import CategoryManager logfile = open('./oldstyles', 'w') def changeCatStyle(cat): for subcat in cat.getSubCategoryList(): currentStyle = subcat.getDefaultStyle("meeting") subcat.setDefaultStyle("meeting", "lhcb_meeting") logfile.write("cat %s: %s" % (subcat.getId(), currentStyle)) changeCatStyle(subcat) for conf in cat.getConferenceList(): currentStyle = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr( conf).getDefaultStyle() displayMgr.ConfDisplayMgrRegistery().getDisplayMgr( conf).setDefaultStyle("lhcb_meeting") logfile.write("\t\t\tconf %s: %s" % (conf.getId(), currentStyle)) dbm = DBMgr.getInstance() dbm.startRequest() cat = CategoryManager().getById('233') currentStyle = cat.getDefaultStyle("meeting") cat.setDefaultStyle("meeting", "lhcb_meeting") logfile.write("cat %s: %s" % (cat.getId(), currentStyle)) changeCatStyle(cat) dbm.endRequest()