예제 #1
0
파일: plugins.py 프로젝트: jt1/indico
 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")
예제 #2
0
파일: plugins.py 프로젝트: arturodr/indico
 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')
예제 #3
0
파일: currency.py 프로젝트: Ictp/indico
    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 [""]
예제 #4
0
파일: plugins.py 프로젝트: arturodr/indico
 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')
예제 #5
0
    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 [""]
예제 #6
0
파일: admins.py 프로젝트: sylvestre/indico
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")