~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/directory_service.py

  • Committer: Aaron Bentley
  • Date: 2008-03-07 13:49:07 UTC
  • mto: (3251.4.8 lp-service)
  • mto: This revision was merged to the branch mainline in revision 3258.
  • Revision ID: aaron@aaronbentley.com-20080307134907-57mziosf1h770wz6
Update docstring

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
"""Directory service registration and usage.
 
18
 
 
19
Directory services are utilities that provide a mapping from URL-like strings
 
20
to true URLs.  Examples include lp:urls and per-user location aliases.
 
21
"""
 
22
 
17
23
from bzrlib import registry
18
24
 
19
25
class DirectoryServiceRegistry(registry.Registry):
 
26
    """This object maintains and uses a list of directory services.
 
27
 
 
28
    Directory services may be registered via the standard Registry methods.
 
29
    They will be invoked if their key is a prefix of the supplied URL.
 
30
 
 
31
    Each item registered should be a factory of objects that provide a look_up
 
32
    method, as invoked by dereference.  Specifically, look_up should accept a
 
33
    name and URL, and return a URL.
 
34
    """
20
35
 
21
36
    def dereference(self, url):
22
37
        """Dereference a supplied URL if possible.
23
38
 
24
39
        URLs that match a registered directory service prefix are looked up in
25
40
        it.  Non-matching urls are returned verbatim.
 
41
 
 
42
        This is applied only once; the resulting URL must not be one that
 
43
        requires further dereferencing.
 
44
 
26
45
        :param url: The URL to dereference
27
46
        :return: The dereferenced URL if applicable, the input URL otherwise.
28
47
        """