~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/registry.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-14 10:55:37 UTC
  • mfrom: (3275 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3281.
  • Revision ID: john@arbash-meinel.com-20080314105537-v9h2ue0uxvs1dyn6
[merge] bzr.dev 3275

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
        """
168
168
        return self._dict[self._get_key_or_default(key)].get_obj()
169
169
 
 
170
    def get_prefix(self, fullname):
 
171
        """Return an object whose key is a prefix of the supplied value.
 
172
 
 
173
        :fullname: The name to find a prefix for
 
174
        :return: a tuple of (object, remainder), where the remainder is the
 
175
            portion of the name that did not match the key.
 
176
        """
 
177
        for key, value in self.iteritems():
 
178
            if fullname.startswith(key):
 
179
                return value, fullname[len(key):]
 
180
 
170
181
    def _get_key_or_default(self, key=None):
171
182
        """Return either 'key' or the default key if key is None"""
172
183
        if key is not None: