vregistry.py
branchtls-sprint
changeset 686 6a1f4210ee4c
parent 682 d95936d6ce5c
child 693 cf0817dfc787
equal deleted inserted replaced
685:2538262ffc29 686:6a1f4210ee4c
   103         if '__select__' in classdict and '__selectors__' in classdict:
   103         if '__select__' in classdict and '__selectors__' in classdict:
   104             raise TypeError("__select__ and __selectors__ "
   104             raise TypeError("__select__ and __selectors__ "
   105                             "can't be used together")
   105                             "can't be used together")
   106         if '__select__' not in classdict and '__selectors__' in classdict:
   106         if '__select__' not in classdict and '__selectors__' in classdict:
   107             selectors = classdict['__selectors__']
   107             selectors = classdict['__selectors__']
       
   108             if not isinstance(selectors, (tuple, list)):
       
   109                 selectors = (selectors,)
   108             if len(selectors) > 1:
   110             if len(selectors) > 1:
   109                 classdict['__select__'] = classmethod(chainall(*selectors))
   111                 classdict['__select__'] = classmethod(chainall(*selectors))
   110             else:
   112             else:
   111                 classdict['__select__'] = classmethod(selectors[0])
   113                 classdict['__select__'] = classmethod(selectors[0])
   112         return super(autoselectors, mcs).__new__(mcs, name, bases, classdict)
   114         return super(autoselectors, mcs).__new__(mcs, name, bases, classdict)