~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/registry.py

  • Committer: Jelmer Vernooij
  • Date: 2011-02-21 15:09:19 UTC
  • mto: This revision was merged to the branch mainline in revision 5675.
  • Revision ID: jelmer@samba.org-20110221150919-v7nnbontcuhi1dmu
Move Repository._find_text_key_references_from_xml_inventory_lines onto the serializer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    def __init__(self, obj):
36
36
        self._obj = obj
37
37
 
38
 
    def get_module(self):
39
 
        """Get the module the object was loaded from."""
40
 
        return self._obj.__module__
41
 
 
42
38
    def get_obj(self):
43
39
        """Get the object that was saved at creation time"""
44
40
        return self._obj
58
54
        self._imported = False
59
55
        super(_LazyObjectGetter, self).__init__(None)
60
56
 
61
 
    def get_module(self):
62
 
        """Get the module the referenced object will be loaded from.
63
 
        """
64
 
        return self._module_name
65
 
 
66
57
    def get_obj(self):
67
58
        """Get the referenced object.
68
59
 
172
163
        """
173
164
        return self._dict[self._get_key_or_default(key)].get_obj()
174
165
 
175
 
    def _get_module(self, key):
176
 
        """Return the module the object will be or was loaded from.
177
 
 
178
 
        :param key: The key to obtain the module for.
179
 
        :return: The name of the module
180
 
        """
181
 
        return self._dict[key].get_module()
182
 
 
183
166
    def get_prefix(self, fullname):
184
167
        """Return an object whose key is a prefix of the supplied value.
185
168
 
256
239
        Registry.__init__(self)
257
240
        self._other_registry = other_registry
258
241
 
259
 
    def register(self, key, obj, help=None, info=None,
260
 
                 override_existing=False):
261
 
        Registry.register(self, key, obj, help=help, info=info,
262
 
            override_existing=override_existing)
263
 
        if self._other_registry is not None:
264
 
            self._other_registry.register(key, obj, help=help,
265
 
                info=info, override_existing=override_existing)
266
 
 
267
242
    def register_lazy(self, key, module_name, member_name,
268
243
                      help=None, info=None,
269
244
                      override_existing=False):
275
250
            self._other_registry.register_lazy(key, module_name, member_name,
276
251
                help=help, info=info, override_existing=override_existing)
277
252
 
278
 
    def remove(self, key):
279
 
        Registry.remove(self, key)
280
 
        if self._other_registry is not None:
281
 
            self._other_registry.remove(key)
282
 
 
283
253
    def get(self, format_string):
284
254
        r = Registry.get(self, format_string)
285
255
        if callable(r):
286
256
            r = r()
287
257
        return r
 
258
 
 
259