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


Python plugins.PluginsHolder类代码示例

本文整理汇总了Python中MaKaC.plugins.PluginsHolder的典型用法代码示例。如果您正苦于以下问题:Python PluginsHolder类的具体用法?Python PluginsHolder怎么用?Python PluginsHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getOptionValueRooms

 def getOptionValueRooms(cls, pluginId, optionName):
     """ Returns the room list of an option with type 'rooms' of a plugin (plugins/Collaboration/XXXXX/options.py)
         pluginName: a string with the name of the plugin
         optionName: a string with the name of the option
     """
     ph = PluginsHolder()
     return ph.getPluginType("Collaboration").getPlugin(pluginId).getOption(optionName).getRooms()
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:collaborationTools.py

示例2: getVars

    def getVars(self):
        ph = PluginsHolder()

        tplVars = WTemplated.getVars(self)
        tplVars["epayment_htdocs"] = UHEPaymentHtdocs.getURL()
        tplVars["currency_data"] = ph.getPluginType('EPayment').getOption("customCurrency").getValue()
        return tplVars
开发者ID:VishrutMehta,项目名称:indico,代码行数:7,代码来源:chrome.py

示例3: eventDetailFooter

    def eventDetailFooter(cls, obj, vars):
        """
        Add the footer extension for the statistics tracking.
        """
        stats = PluginsHolder().getPluginType('statistics')
        register = StatisticsRegister()

        if not stats.isActive() or not register.hasActivePlugins():
            return False

        key = 'extraFooterContent'
        extension = {}
        tracking = {}

        tracking['trackingActive'] = True
        tracking['trackingHooks'] = register.getAllPluginJSHooks(obj)

        # Build the extension object to be passed to the footer.
        extension['path'] = register.getJSInjectionPath()
        extension['args'] = tracking

        if key not in vars:
            vars[key] = [extension]
        else:
            vars[key].append(extension)
开发者ID:aninhalacerda,项目名称:indico,代码行数:25,代码来源:chrome.py

示例4: getOptionValue

 def getOptionValue(cls, pluginId, optionName):
     """ Returns the value of an option of a plugin (plugins/Collaboration/XXXXX/options.py)
         pluginName: a string with the name of the plugin
         optionName: a string with the name of the option
     """
     ph = PluginsHolder()
     return ph.getPluginType("Collaboration").getPlugin(pluginId).getOption(optionName).getValue()
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:collaborationTools.py

示例5: getList

    def getList( self ):

        ph = PluginsHolder()
        if ph.hasPluginType("EPayment"):
            self._targetOption = ph.getPluginType("EPayment").getOption("customCurrency")
            currencies = self._targetOption.getValue()
            currenciesList = []
            for currency in currencies:
                currenciesList.append(currency["abbreviation"])
            return currenciesList

        else:
            raise ServiceError('ERR-PLUG3', 'pluginType: ' + str("EPayment") + ' does not exist, is not visible or not active')

        return [""]
开发者ID:Ictp,项目名称:indico,代码行数:15,代码来源:currency.py

示例6: _getAnswer

    def _getAnswer(self):        
        #entries = json.loads(self._data)['data']
        try:
            from indico.util.ICTP_available_sponsors import ocirne_dictionary as available_sponsors
        except:
            available_sponsors = {}

        # init sponsor vocabulary
        plugin = PluginsHolder().getPluginType('ictp_addons').getPlugin("sponsor_management")
        #sponsors_array = plugin.getOptions()["sponsors"].getValue()
        sponsors_array = []

        if plugin.isActive():
            for k in available_sponsors.keys():
                d = available_sponsors[k]
                logo = ''
                if d.has_key('logo'):
                    logo = d['logo']
                elem = {
                    'name': k, 
                    'title': d['title'], 
                    'country': d['country'], 
                    'logo': logo,
                    'optionname': 'ictp_addons.sponsor_management.sponsors', 
                    'structure': d['url'],
                    }
                sponsors_array.append(elem)
            
            
        

        #return json.dumps({'success': True, 'table': sponsors_array})


        #print "addLink sponsors_array=",sponsors_array

        self._targetOption.setValue(sponsors_array)
        self._targetOption._notifyModification()
        #plugin.getOption("sponsors").setValue(sponsors_array)
        #print "addLink targetOption+",self._targetOption.getValue()
        
        return {'success': True, 'table': sponsors_array}
开发者ID:Ictp,项目名称:ictp_addons,代码行数:42,代码来源:handlers.py

示例7: RHAdminPluginsBase

class RHAdminPluginsBase(RoomBookingDBMixin, RHAdminBase):
    """ Base RH class for all plugin management requests.
        It will store 2 string parameters: pluginType and pluginId.
        Example: pluginType = "COllaboration" & pluginId = "EVO"
    """

    def _checkParams(self, params):
        RHAdminBase._checkParams(self, params)
        self._pluginType = params.get("pluginType", None)
        #take out white spaces in case there are some
        if self._pluginType:
            self._pluginType = self._pluginType.replace(' ', '')
        self._pluginId = params.get("pluginId", None)
        #take out white spaces in case there are some
        if self._pluginId:
            self._pluginId = self._pluginId.replace(' ', '')
        self._ph = PluginsHolder()
        if self._pluginType and not self._ph.hasPluginType(self._pluginType, mustBeActive = False):
            raise PluginError("The plugin type " + self._pluginType + " does not exist or is not visible")
        elif self._pluginType and self._pluginId and not self._ph.getPluginType(self._pluginType).hasPlugin(self._pluginId):
            raise PluginError("The plugin " + self._pluginId + " does not exist")
开发者ID:VishrutMehta,项目名称:indico,代码行数:21,代码来源:admins.py

示例8: _checkParams

 def _checkParams(self):
     optionName = self._params.get("optionName", None)
     if optionName:
         options = optionName.split(".")
         ph = PluginsHolder()
         if len(options) == 3:
             pluginType, plugin, option = options
             if ph.hasPluginType(pluginType):
                 if ph.getPluginType(pluginType).hasPlugin(plugin):
                     self._targetOption = ph.getPluginType(pluginType).getPlugin(plugin).getOption(option)
                 else:
                     raise ServiceError("ERR-PLUG4", "plugin: " + str(plugin) + " does not exist")
             else:
                 raise ServiceError(
                     "ERR-PLUG3", "pluginType: " + str(pluginType) + " does not exist, is not visible or not active"
                 )
         elif len(options) == 2:
             pluginType, option = options
             if ph.hasPluginType(pluginType):
                 self._targetOption = ph.getPluginType(pluginType).getOption(option)
             else:
                 raise ServiceError(
                     "ERR-PLUG3", "pluginType: " + str(pluginType) + " does not exist, is not visible or not active"
                 )
         else:
             raise ServiceError(
                 "ERR-PLUG1", "optionName argument does not have the proper pluginType.plugin.option format"
             )
     else:
         raise ServiceError("ERR-PLUG0", "optionName argument not present")
开发者ID:jt1,项目名称:indico,代码行数:30,代码来源:plugins.py

示例9: _checkParams

 def _checkParams(self, params):
     RHAdminBase._checkParams(self, params)
     self._pluginType = params.get("pluginType", None)
     #take out white spaces in case there are some
     if self._pluginType:
         self._pluginType = self._pluginType.replace(' ', '')
     self._pluginId = params.get("pluginId", None)
     #take out white spaces in case there are some
     if self._pluginId:
         self._pluginId = self._pluginId.replace(' ', '')
     self._ph = PluginsHolder()
     if self._pluginType and not self._ph.hasPluginType(self._pluginType, mustBeActive = False):
         raise PluginError("The plugin type " + self._pluginType + " does not exist or is not visible")
     elif self._pluginType and self._pluginId and not self._ph.getPluginType(self._pluginType).hasPlugin(self._pluginId):
         raise PluginError("The plugin " + self._pluginId + " does not exist")
开发者ID:VishrutMehta,项目名称:indico,代码行数:15,代码来源:admins.py

示例10: _checkParams

 def _checkParams(self):
     optionName = self._params.get('optionName', None)
     if optionName:
         options = optionName.split('.')
         ph = PluginsHolder()
         if len(options) == 3:
             pluginType, plugin, option = options
             if ph.hasPluginType(pluginType):
                 if ph.getPluginType(pluginType).hasPlugin(plugin):
                     self._targetOption = ph.getPluginType(pluginType).getPlugin(plugin).getOption(option)
                 else:
                     raise ServiceError('ERR-PLUG4', 'plugin: ' + str(plugin) + ' does not exist')
             else:
                 raise ServiceError('ERR-PLUG3', 'pluginType: ' + str(pluginType) + ' does not exist, is not visible or not active')
         elif len(options) == 2:
             pluginType, option = options
             if ph.hasPluginType(pluginType):
                 self._targetOption = ph.getPluginType(pluginType).getOption(option)
             else:
                 raise ServiceError('ERR-PLUG3', 'pluginType: ' + str(pluginType) + ' does not exist, is not visible or not active')
         else:
             raise ServiceError('ERR-PLUG1', 'optionName argument does not have the proper pluginType.plugin.option format')
     else:
         raise ServiceError('ERR-PLUG0', 'optionName argument not present')
开发者ID:arturodr,项目名称:indico,代码行数:24,代码来源:plugins.py

示例11: runTests

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,代码行数:93,代码来源:upload_benchmark.py

示例12: _checkParams

 def _checkParams(self):
     AdminService._checkParams(self)
     ph = PluginsHolder()
     self._targetOption = ph.getPluginType("EPayment").getOption("customCurrency")
     self._currencyName = self._params.get("name", None)
     self._currencies = self._targetOption.getValue()
开发者ID:jt1,项目名称:indico,代码行数:6,代码来源:handlers.py

示例13: _sendEventRequest

 def _sendEventRequest(self, key, eventType, avatar, conference):
     try:
         logger = self.getLogger()
         plugin = PluginsHolder().getPluginType('calendaring').getPlugin('outlook')
         if not isUserPluginEnabled(avatar.getId()):
             logger.info("Outlook plugin disabled for user: {}".format(avatar.getId()))
             return {'status_code': 200}
         if eventType in ['added', 'updated']:
             logger.debug("Performing '{}' for: {}".format(eventType, avatar.getId()))
             url = urlHandlers.UHConferenceDisplay.getURL(conference)
             location = strip_control_chars(conference.getRoom().getName()) if conference.getRoom() else ''
             description = strip_control_chars(conference.getDescription())
             self.payload = {'userEmail': avatar.getEmail(),
                             'uniqueID': plugin.getOption('prefix').getValue() + key,
                             'subject': strip_control_chars(conference.getTitle()),
                             'location': location,
                             'body': '<a href="{}">{}</a><br><br>{}'.format(url, url, description),
                             'status': plugin.getOption('status').getValue(),
                             'startDate': format_datetime(conference.getStartDate(),
                                                          format=plugin.getOption('datetimeFormat').getValue(),
                                                          timezone=pytz.utc),
                             'endDate': format_datetime(conference.getEndDate(),
                                                        format=plugin.getOption('datetimeFormat').getValue(),
                                                        timezone=pytz.utc),
                             'isThereReminder': plugin.getOption('reminder').getValue(),
                             'reminderTimeInMinutes': plugin.getOption('reminder_minutes').getValue()}
             operation = plugin.getOption('addToCalendarOperationName').getValue() if eventType == 'added' else plugin.getOption('updateCalendarOperationName').getValue()
         elif eventType == 'removed':
             logger.debug("Removing calendar entry for: {}".format(avatar.getId()))
             self.payload = {'userEmail': avatar.getEmail(),
                             'uniqueID': plugin.getOption('prefix').getValue() + key}
             operation = plugin.getOption('removeFromCalendarOperationName').getValue()
         else:
             return None
         headers = {'content-type': 'application/x-www-form-urlencoded'}
         return requests.post(urlpath.tslash(plugin.getOption('url').getValue()) + operation,
                              auth=(plugin.getOption('login').getValue(), plugin.getOption('password').getValue()),
                              data=self.payload, headers=headers, timeout=plugin.getOption('timeout').getValue())
     except requests.exceptions.Timeout:
         logger.exception('Timeout')
     except requests.exceptions.RequestException:
         logger.exception('RequestException: Connection problem')
     except Exception, e:
         logger.exception('Outlook EventException: {}'.format(e))
开发者ID:pferreir,项目名称:indico-backup,代码行数:44,代码来源:tasks.py

示例14: getCustomerUsername

 def getCustomerUsername(self):
     ph = PluginsHolder()
     return ph.getPluginType("EPayment").getPlugin("eWay").getOption("customer_username").getValue()
开发者ID:AustralianSynchrotron,项目名称:indico_eway,代码行数:3,代码来源:epayment.py

示例15: getUrl

 def getUrl(self):
     ph = PluginsHolder()
     return ph.getPluginType("EPayment").getPlugin("eWay").getOption("url").getValue()
开发者ID:AustralianSynchrotron,项目名称:indico_eway,代码行数:3,代码来源:epayment.py


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