~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hooks.py

  • Committer: Vincent Ladeuil
  • Date: 2007-11-04 15:24:27 UTC
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071104152427-p9k7e4toywa87wfc
Review feedback.

* doc/en/user-guide/authentication_conf.txt: 
New file. Authentication configuration file documentation.

* doc/en/user-guide/configuration.txt: 
Slight modifications, add authentication.conf reference.

* doc/en/mini-tutorial/index.txt: 
Fix make docs warning.

* doc/developers/authentication-ring.txt: 
Small cleanups noticed during
doc/en/user-guide/authentication_conf.txt redaction.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Use a dict() instead of {} syntax.

* bzrlib/tests/blackbox/test_whoami.py:
(TestWhoami.test_whoami_branch): Delete BZREMAIL related tests.

* bzrlib/config.py:
(Config.username): BZREMAIL deleted, has been obsolete for more
than a year.
(AuthenticationConfig.__init__): Review feedback, since keeping a
callback as an attribute is useless, call it now and keep the
filename itself as an attribute.
(AuthenticationConfig.get_credentials): Use a dict() instead of {}
syntax.

* NEWS: 
Updated as per Martin's suggestion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Support for plugin hooking logic."""
19
19
from bzrlib.lazy_import import lazy_import
20
 
from bzrlib.symbol_versioning import deprecated_method, one_five
21
20
lazy_import(globals(), """
22
21
from bzrlib import (
23
22
        errors,
46
45
        """
47
46
        return self._callable_names.get(a_callable, "No hook name")
48
47
 
49
 
    @deprecated_method(one_five)
50
48
    def install_hook(self, hook_name, a_callable):
51
49
        """Install a_callable in to the hook hook_name.
52
50
 
56
54
            The exact signature will depend on the hook - see the __init__ 
57
55
            method of BranchHooks for details on each hook.
58
56
        """
59
 
        self.install_named_hook(hook_name, a_callable, None)
60
 
 
61
 
    def install_named_hook(self, hook_name, a_callable, name):
62
 
        """Install a_callable in to the hook hook_name, and label it name.
63
 
 
64
 
        :param hook_name: A hook name. See the __init__ method of BranchHooks
65
 
            for the complete list of hooks.
66
 
        :param a_callable: The callable to be invoked when the hook triggers.
67
 
            The exact signature will depend on the hook - see the __init__ 
68
 
            method of BranchHooks for details on each hook.
69
 
        :param name: A name to associate a_callable with, to show users what is
70
 
            running.
71
 
        """
72
57
        try:
73
58
            self[hook_name].append(a_callable)
74
59
        except KeyError:
75
60
            raise errors.UnknownHook(self.__class__.__name__, hook_name)
76
 
        if name is not None:
77
 
            self.name_hook(a_callable, name)
78
61
 
79
62
    def name_hook(self, a_callable, name):
80
63
        """Associate name with a_callable to show users what is running."""