Removed ple prefix to the user query in topmenu
[unfold.git] / manifold / util / plugin_factory.py
1 from manifold.util.log             import Log
2
3 class PluginFactory(type):
4     def __init__(cls, name, bases, dic):
5         #super(PluginFactory, cls).__init__(name, bases, dic)
6         type.__init__(cls, name, bases, dic)
7
8         try:
9             registry = getattr(cls, 'registry')
10         except AttributeError:
11             setattr(cls, 'registry', {})
12             registry = getattr(cls, 'registry')
13         # XXX
14         if name != "Gateway":
15             if name.endswith('Gateway'):
16                 name = name[:-7]
17             name = name.lower()
18             registry[name] = cls
19
20         def get(self, name):
21             return registry[name.lower()]
22
23         # Adding a class method get to retrieve plugins by name
24         setattr(cls, 'get', classmethod(get))