equal
deleted
inserted
replaced
1 """ |
1 """ |
2 * the vregistry handle various type of objects interacting |
2 * the vregistry handles various types of objects interacting |
3 together. The vregistry handle registration of dynamically loaded |
3 together. The vregistry handles registration of dynamically loaded |
4 objects and provide a convenient api access to those objects |
4 objects and provides a convenient api to access those objects |
5 according to a context |
5 according to a context |
6 |
6 |
7 * to interact with the vregistry, object should inherit from the |
7 * to interact with the vregistry, objects should inherit from the |
8 VObject abstract class |
8 VObject abstract class |
9 |
9 |
10 * the selection procedure has been generalized by delegating to a |
10 * the selection procedure has been generalized by delegating to a |
11 selector, which is responsible to score the vobject according to the |
11 selector, which is responsible to score the vobject according to the |
12 current state (req, rset, row, col). At the end of the selection, if |
12 current state (req, rset, row, col). At the end of the selection, if |
186 assert len(objects) == 1, objects |
186 assert len(objects) == 1, objects |
187 return objects[0].selected(*args, **kwargs) |
187 return objects[0].selected(*args, **kwargs) |
188 |
188 |
189 # methods for explicit (un)registration ################################### |
189 # methods for explicit (un)registration ################################### |
190 |
190 |
191 # def clear(self, key): |
|
192 # regname, oid = key.split('.') |
|
193 # self[regname].pop(oid, None) |
|
194 def register_all(self, objects, modname, butclasses=()): |
191 def register_all(self, objects, modname, butclasses=()): |
195 for obj in objects: |
192 for obj in objects: |
196 try: |
193 try: |
197 if obj.__module__ != modname or obj in butclasses: |
194 if obj.__module__ != modname or obj in butclasses: |
198 continue |
195 continue |