本文整理汇总了Python中MaKaC.conference.CategoryManager.getId方法的典型用法代码示例。如果您正苦于以下问题:Python CategoryManager.getId方法的具体用法?Python CategoryManager.getId怎么用?Python CategoryManager.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.conference.CategoryManager
的用法示例。
在下文中一共展示了CategoryManager.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _process_PUT
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getId [as 别名]
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)
示例2: _process_DELETE
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getId [as 别名]
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)
示例3: get_excluded_categories
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getId [as 别名]
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
示例4: changeCatStyle
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getId [as 别名]
## 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()