~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/symbol_versioning.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-10 01:05:01 UTC
  • mfrom: (2872.5.5 129701-readonly-commit)
  • Revision ID: pqm@pqm.ubuntu.com-20071010010501-ejbj03m5w3k9vdsd
Avoid internal error tracebacks on failure to lock on readonly transport (#129701)

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        have a single %s operator in it. a_callable will be turned into a nice
87
87
        python symbol and then substituted into deprecation_version.
88
88
    """
 
89
    # We also want to handle old-style classes, in particular exception, and
 
90
    # they don't have an im_class attribute.
89
91
    if getattr(a_callable, 'im_class', None) is None:
90
92
        symbol = "%s.%s" % (a_callable.__module__,
91
93
                            a_callable.__name__)
131
133
        
132
134
        def decorated_method(self, *args, **kwargs):
133
135
            """This is the decorated method."""
134
 
            symbol = "%s.%s.%s" % (self.__class__.__module__,
135
 
                                   self.__class__.__name__,
136
 
                                   callable.__name__
137
 
                                   )
 
136
            if callable.__name__ == '__init__':
 
137
                symbol = "%s.%s" % (self.__class__.__module__,
 
138
                                    self.__class__.__name__,
 
139
                                    )
 
140
            else:
 
141
                symbol = "%s.%s.%s" % (self.__class__.__module__,
 
142
                                       self.__class__.__name__,
 
143
                                       callable.__name__
 
144
                                       )
138
145
            warn(deprecation_version % symbol, DeprecationWarning, stacklevel=2)
139
146
            return callable(self, *args, **kwargs)
140
147
        _populate_decorated(callable, deprecation_version, "method",