Changeset 605179 in indico


Ignore:
Timestamp:
02/24/11 13:54:32 (2 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
4ff1b2
Parents:
3632eb
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (02/04/11 12:09:02)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (02/24/11 13:54:32)
Message:

[MIN] Support plugin option subtypes

  • for internal use e.g. in the pluginoptionlist template
  • to configure a certain option
Location:
indico/MaKaC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/base.py

    r8f1ea9 r605179  
    168168        return {"description": description, 
    169169                "type": optionType, 
     170                "subType": attributes.get("subType", None), 
    170171                "defaultValue": attributes.get("defaultValue", None), 
    171172                "editable": attributes.get("editable", True), 
     
    239240        self.__options[name] = PluginOption(name, attributes["description"], attributes["type"], 
    240241                                            attributes["defaultValue"], attributes["editable"], attributes["visible"], 
    241                                             attributes["mustReload"], True, order) 
     242                                            attributes["mustReload"], True, order, attributes["subType"]) 
    242243        self._notifyModification() 
    243244 
     
    252253        option.setDescription(attributes["description"]) 
    253254        option.setType(attributes["type"]) 
     255        option.setSubType(attributes["subType"]) 
    254256        option.setEditable(attributes["editable"]) 
    255257        option.setVisible(attributes["visible"]) 
     
    697699    } 
    698700 
    699     def __init__(self, name, description, valueType, value=None, editable=True, visible=True, mustReload=False, present=True, order=0): 
     701    def __init__(self, name, description, valueType, value=None, editable=True, visible=True, mustReload=False, present=True, order=0, subType=None): 
    700702        self.__name = name 
    701703        self.__description = description 
    702704        self.__type = valueType 
     705        self.__subType = subType 
    703706        self.__present = present 
    704707        self.__editable = editable 
     
    721724        return self.__type 
    722725 
     726    def getSubType(self): 
     727        return self.__subType 
     728 
    723729    def getValue(self): 
    724730        return self.__value 
     
    760766    def setType(self, valueType): 
    761767        self.__type = valueType 
     768 
     769    def setSubType(self, subType): 
     770        self.__subType = subType 
    762771 
    763772    def setValue(self, value): 
  • indico/MaKaC/services/implementation/plugins.py

    r107f4e r605179  
    2525 
    2626class PluginOptionsBase (AdminService): 
    27      
     27 
    2828    def _checkParams(self): 
    2929        optionName = self._params.get('optionName', None) 
     
    4949                raise ServiceError('ERR-PLUG1', 'optionName argument does not have the proper pluginType.plugin.option format') 
    5050        else: 
    51             raise ServiceError('ERR-PLUG0', 'optionName argument not present')  
    52              
     51            raise ServiceError('ERR-PLUG0', 'optionName argument not present') 
     52 
    5353 
    5454class PluginOptionsAddUsers ( PluginOptionsBase, UserListModificationBase): 
    55      
     55 
    5656    def _checkParams(self): 
    5757        PluginOptionsBase._checkParams(self) 
    5858        UserListModificationBase._checkParams(self) 
    59          
     59 
    6060    def _getAnswer(self): 
    6161        if self._targetOption.getType() == 'users' or self._targetOption.getType() == 'usersGroups': 
     
    6868        else: 
    6969            raise ServiceError('ERR-PLUG2', "option %s.%s.%s is not of type 'users'" % (self._pluginType, self._plugin, self._targetOption)) 
    70          
     70 
    7171        return True 
    7272 
     
    7676        PluginOptionsBase._checkParams(self) 
    7777        UserModificationBase._checkParams(self) 
    78          
     78 
    7979    def _getAnswer(self): 
    8080        if self._targetOption.getType() == 'users' or self._targetOption.getType() == 'usersGroups': 
     
    8383        else: 
    8484            raise ServiceError('ERR-PLUG2', "option %s.%s.%s is not of type 'users'" % (self._pluginType, self._plugin, self._targetOption)) 
    85          
     85 
    8686        return True 
    8787 
    8888class PluginOptionsAddRooms ( PluginOptionsBase ): 
    89      
     89 
    9090    def _checkParams(self): 
    9191        PluginOptionsBase._checkParams(self) 
    92          
     92 
    9393    def _getAnswer(self): 
    9494        if self._targetOption.getType() == 'rooms': 
     
    100100        else: 
    101101            raise ServiceError('ERR-PLUG2', "option %s.%s.%s is not of type 'rooms'" % (self._pluginType, self._plugin, self._targetOption)) 
    102          
     102 
    103103        return True 
    104104 
     
    107107    def _checkParams(self): 
    108108        PluginOptionsBase._checkParams(self) 
    109          
     109 
    110110    def _getAnswer(self): 
    111111        if self._targetOption.getType() == 'rooms': 
Note: See TracChangeset for help on using the changeset viewer.