/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/symbol_versioning.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-12 05:26:46 UTC
  • mfrom: (2904 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2906.
  • Revision ID: andrew.bennetts@canonical.com-20071012052646-wl95idld3ijjy714
Merge from bzr.dev.

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",