当前位置: 首页>>代码示例>>Python>>正文


Python CategoryManager.getById方法代码示例

本文整理汇总了Python中MaKaC.conference.CategoryManager.getById方法的典型用法代码示例。如果您正苦于以下问题:Python CategoryManager.getById方法的具体用法?Python CategoryManager.getById怎么用?Python CategoryManager.getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MaKaC.conference.CategoryManager的用法示例。


在下文中一共展示了CategoryManager.getById方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _checkParams

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
    def _checkParams(self, params):

        base.RHProtected._checkParams(self, params)
        self._statusValue = "OK"
        self._message = ""
        try:
            self._title = params.get( "title", "" ).strip()
            self._startdate = params.get( "startdate", "" ).strip()
            self._enddate = params.get( "enddate", "" ).strip()
            self._place = params.get( "place", "" ).strip()
            self._room = params.get( "room", "" ).strip()
            self._accessPassword = params.get( "an", "" ).strip()
            self._modifyPassword = params.get( "mp", "" ).strip()
            self._style = params.get( "style", "" ).strip()
            self._fid = params.get( "fid", "" ).strip()
            self._description = params.get( "description", "" ).strip()
            self._stime = params.get( "stime", "" ).strip()
            self._etime = params.get( "etime", "" ).strip()
            self._speaker = params.get( "speaker", "" ).strip()
            self._speakeremail = params.get( "email", "" ).strip()
            self._speakeraffiliation = params.get( "affiliation", "" ).strip()
            if not self._title or not self._startdate or not self._enddate or not self._fid or not self._stime or not self._etime:
                raise MaKaCError( _("mandatory parameter missing"))
            ch = CategoryManager()
            try:
                self._cat = ch.getById(self._fid)
            except:
                raise MaKaCError( _("unknown category"))
        except MaKaCError, e:
          self._statusValue = "ERROR"
          self._message = e.getMsg()
开发者ID:lukasnellen,项目名称:indico,代码行数:33,代码来源:xmlGateway.py

示例2: _process

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
 def _process( self ):
     self._responseUtil.content_type = 'text/xml'
     cm = CategoryManager()
     try:
         XG = xmlGen.XMLGen()
         cat = cm.getById(self._id)
         self._getHeader(XG)
         self._getCategXML(cat, XG, self._fp)
         self._getFooter(XG)
         return XG.getXml()
     except:
         value = "ERROR"
         message = "Category does not exist"
     if value != "OK":
         return self._createResponse(value, message)
开发者ID:Ictp,项目名称:indico,代码行数:17,代码来源:xmlGateway.py

示例3: initialize_new_db

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
def initialize_new_db(root):
    """
    Initializes a new DB in debug mode
    """

    # Reset everything
    for e in root.keys():
        del root[e]

    # Delete whoosh indexes
    whoosh_dir = os.path.join(Config.getInstance().getArchiveDir(), 'whoosh')
    if os.path.exists(whoosh_dir):
        delete_recursively(whoosh_dir)

    # initialize db root
    cm = CategoryManager()
    cm.getRoot()

    return cm.getById('0')
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:21,代码来源:default_actions.py

示例4: initialize_new_db

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
def initialize_new_db(root):
    """
    Initializes a new DB in debug mode
    """

    # Reset everything
    for e in root.keys():
        del root[e]

    # initialize db root
    cm = CategoryManager()
    cm.getRoot()

    home = cm.getById('0')

    # set debug mode on
    minfo = HelperMaKaCInfo.getMaKaCInfoInstance()
    minfo.setDebugActive(True)

    return home
开发者ID:ferhatelmas,项目名称:indico,代码行数:22,代码来源:default_actions.py

示例5: updateCategsAndEvents

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
def updateCategsAndEvents():

    DBMgr.getInstance().startRequest()
    cm = CategoryManager()
    l = [cat.getId() for cat in cm.getList()]
    DBMgr.getInstance().endRequest()
    for id in l:
        DBMgr.getInstance().startRequest()
        cat = cm.getById(id)
        log("\nupdate category %s:%s"%(cat.getId(), cat.getName()))
        if cat.getId() in catTZMap.keys() and catTZMap[cat.getId()] :
            tz = catTZMap[cat.getId()]
            log("    found tz for this category: %s"%tz)
        else:
            tz = defTZ
            log("    use default tz: %s"%tz)
        cat.setTimezone(tz)
        updateCatTasks(cat)
        for conf in cat.getConferenceList():
            updateEvent(conf, tz)
            log("  conf %s: %s updated with tz: %s"%(conf.getId(), conf.getTitle(), tz))
        DBMgr.getInstance().endRequest()
开发者ID:Ictp,项目名称:indico,代码行数:24,代码来源:TZMigration.py

示例6: checkGroup

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
from MaKaC.conference import CategoryManager
from MaKaC.webinterface.urlHandlers import UHCategoryDisplay, UHConferenceDisplay


def checkGroup (obj, group):
    ac = obj.getAccessController()
    if group in ac.allowed:
        return True
    return False

def showSubCategory(cat, group):
    if checkGroup(cat, group):
        print "%s - %s"%(cat.getName(), UHCategoryDisplay.getURL(cat))
    if cat.hasSubcategories():
        for subcat in cat.getSubCategoryList():
            showSubCategory(subcat,group)
    else:
        for conference in  cat.getConferenceList():
           if checkGroup(conference, group):
               print "%s - %s"%(conference.getName(), UHConferenceDisplay.getURL(conference))

DBMgr.getInstance().startRequest()
cm=CategoryManager()
cat=cm.getById("XXXX")
group = GroupHolder().getById("YYYYY")
showSubCategory(cat, group)


DBMgr.getInstance().endRequest()

开发者ID:VishrutMehta,项目名称:indico,代码行数:31,代码来源:getAllCatAccess.py

示例7: Copyright

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
## This file is part of Indico.
## Copyright (C) 2002 - 2012 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 3 of the
## License, or (at your option) any later version.
##
## Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see <http://www.gnu.org/licenses/>.

from MaKaC.common import DBMgr
from MaKaC.conference import CategoryManager

DBMgr.getInstance().startRequest()
cm=CategoryManager()

cat=cm.getById('2l76')
conferences= cat.getAllConferenceList()
f = open("statusProtection.txt","w")
for conference in conferences:
    f.write(conference.getId() + " " + conference.getTitle() + " " + str(conference.isItselfProtected()) + " " + str(conference.isProtected())  + "\n")
f.close()
DBMgr.getInstance().endRequest()

开发者ID:aninhalacerda,项目名称:indico,代码行数:31,代码来源:getStatusProtectionCategory.py

示例8: runTests

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [as 别名]
def runTests(host='localhost', port=FAKE_SERVICE_PORT,
             scenarios=[(2, 10)]):

    execTimes = []

    agent = InvenioBatchUploaderAgent('test1', 'test1', 'test',
                                      0, 'http://%s:%s' \
                                      % (host, port))

    ph = PluginsHolder()
    ph.reloadAllPlugins()
    ph.getPluginType('livesync').toggleActive()
    do = DummyObservable()

    do._notify('updateDBStructures', 'indico.ext.livesync',
                              None, None, None)

    sm = SyncManager.getDBInstance()

    sm.registerNewAgent(agent)

    cm = CategoryManager()

    avatar = user.Avatar()
    avatar.setName( "fake" )
    avatar.setSurName( "fake" )
    avatar.setOrganisation( "fake" )
    avatar.setLang( "en_GB" )
    avatar.setEmail( "[email protected]" )

    #registering user
    ah = user.AvatarHolder()
    ah.add(avatar)

    #setting up the login info
    li = user.LoginInfo( "dummyuser", "dummyuser" )
    ih = AuthenticatorMgr()
    userid = ih.createIdentity( li, avatar, "Local" )
    ih.add( userid )

    #activate the account
    avatar.activateAccount()

    #since the DB is empty, we have to add dummy user as admin
    minfo = HelperMaKaCInfo.getMaKaCInfoInstance()
    al = minfo.getAdminList()
    al.grant( avatar )

    dummy = avatar

    ContextManager.destroy()

    HelperMaKaCInfo.getMaKaCInfoInstance().setDefaultConference(DefaultConference())

    cm.getRoot()

    do._notify('requestStarted')

    home = cm.getById('0')

    # execute code
    for nconf in range(0, 1000):
        conf = home.newConference(dummy)
        conf.setTitle('Test Conference %s' % nconf)

    do._notify('requestFinished')

    time.sleep(1)

    # params won't be used
    task = LiveSyncUpdateTask(dateutil.rrule.MINUTELY)

    for scen in scenarios:

        print "Scenario %s workers, size = %s " % scen,

        # configure scenario
        InvenioBatchUploaderAgent.NUM_WORKERS = scen[0]
        InvenioBatchUploaderAgent.BATCH_SIZE = scen[1]

        ts = time.time()
        # just run it
        task.run()

        te = time.time()
        execTimes.append(te - ts)

        print "%s" % (te - ts)

        sm._track._pointers['test1'] = None

    for i in range(0, len(execTimes)):
        results[scenarios[i]] = execTimes[i]
开发者ID:aninhalacerda,项目名称:indico,代码行数:95,代码来源:upload_benchmark.py

示例9: isinstance

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [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.user import Group
from MaKaC.conference import CategoryManager

DBMgr.getInstance().startRequest()
cm=CategoryManager()

catcounter = 0
mgrscounter = 0
notSendTo={}
catList=[]
rootCatList=[]
rootCatList.append(cm.getById('1l28'))
rootCatList.append(cm.getById('1l30'))
for cat in rootCatList:
    for scat in cat.getSubCategoryList():
        catList.append(scat)

for cat in catList:
    ml = cat.getManagerList()
    if ml:
        l=[]
        for mng in ml:
            if isinstance(mng, Group):
                if notSendTo.has_key(cat.getId()):
                    notSendTo[cat.getId()].append(mng.getName())
                else:
                    notSendTo[cat.getId()]=[]
开发者ID:Ictp,项目名称:indico,代码行数:33,代码来源:getAllCatManagers.py

示例10: CategoryManager

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getById [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 MaKaC.common import DBMgr
from MaKaC.user import Group
from MaKaC.conference import CategoryManager

DBMgr.getInstance().startRequest()
cm = CategoryManager()

catcounter = 0
mgrscounter = 0
notSendTo = {}
catList = []
rootCatList = []
rootCatList.append(cm.getById("1l28"))
rootCatList.append(cm.getById("1l30"))
for cat in rootCatList:
    for scat in cat.getSubCategoryList():
        catList.append(scat)

for cat in catList:
    ml = cat.getManagerList()
    if ml:
        l = []
        for mng in ml:
            if isinstance(mng, Group):
                if notSendTo.has_key(cat.getId()):
                    notSendTo[cat.getId()].append(mng.getName())
                else:
                    notSendTo[cat.getId()] = []
开发者ID:jt1,项目名称:indico,代码行数:33,代码来源:getAllCatManagers.py


注:本文中的MaKaC.conference.CategoryManager.getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。