vregistry.py
branchtls-sprint
changeset 741 8c810ee593a3
parent 739 39721e56b56d
child 754 937f5feac7f0
child 759 e044f28372bd
equal deleted inserted replaced
740:e92c19eaf63f 741:8c810ee593a3
   110 
   110 
   111         It must return the  object that will be actually registered (this
   111         It must return the  object that will be actually registered (this
   112         may be the right hook to create an instance for example). By
   112         may be the right hook to create an instance for example). By
   113         default the vobject is returned without any transformation.
   113         default the vobject is returned without any transformation.
   114         """
   114         """
   115         cls.__select__ = cls.build___select__()
   115         cls.build___select__()
   116         return cls
   116         return cls
   117 
   117 
   118     @classmethod
   118     @classmethod
   119     def selected(cls, *args, **kwargs):
   119     def selected(cls, *args, **kwargs):
   120         """called by the registry when the vobject has been selected.
   120         """called by the registry when the vobject has been selected.
   144             # is in a parent class)
   144             # is in a parent class)
   145             selectors = classdict['__selectors__']
   145             selectors = classdict['__selectors__']
   146             if len(selectors) == 1:
   146             if len(selectors) == 1:
   147                 # micro optimization: don't bother with AndSelector if there's
   147                 # micro optimization: don't bother with AndSelector if there's
   148                 # only one selector
   148                 # only one selector
   149                 return _instantiate_selector(selectors[0])
   149                 select = _instantiate_selector(selectors[0])
   150             return AndSelector(_instantiate_selector(selector)
   150             else:
   151                                for selector in selectors)
   151                 select = AndSelector(*[_instantiate_selector(selector)
   152         return cls.__select__
   152                                        for selector in selectors])
       
   153             cls.__select__ = select
   153 
   154 
   154 
   155 
   155 class VRegistry(object):
   156 class VRegistry(object):
   156     """class responsible to register, propose and select the various
   157     """class responsible to register, propose and select the various
   157     elements used to build the web interface. Currently, we have templates,
   158     elements used to build the web interface. Currently, we have templates,