~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/symbol_versioning.py

  • Committer: Robert Collins
  • Date: 2006-01-05 12:46:46 UTC
  • mto: (1534.1.2 integration)
  • mto: This revision was merged to the branch mainline in revision 1536.
  • Revision ID: robertc@robertcollins.net-20060105124646-af18da35bc3f64b4
Set the __name__ attribute on decorated methods and functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
                                )
56
56
            warn(deprecation_version % symbol, DeprecationWarning)
57
57
            return callable(*args, **kwargs)
58
 
        _decorate_docstring(callable, deprecation_version, "function",
 
58
        _populate_decorated(callable, deprecation_version, "function",
59
59
                            decorated_function)
60
60
        return decorated_function
61
61
    return function_decorator
78
78
                                   )
79
79
            warn(deprecation_version % symbol, DeprecationWarning)
80
80
            return callable(self, *args, **kwargs)
81
 
        _decorate_docstring(callable, deprecation_version, "method",
 
81
        _populate_decorated(callable, deprecation_version, "method",
82
82
                            decorated_method)
83
83
        return decorated_method
84
84
    return method_decorator
102
102
        new_doc += deprecation_version % ("This " + label)
103
103
        new_doc += "\n" + " " * spaces
104
104
        decorated_callable.__doc__ = new_doc
 
105
 
 
106
 
 
107
def _populate_decorated(callable, deprecation_version, label,
 
108
                        decorated_callable):
 
109
    """Populate attributes like __name__ and __doc__ on the decorated callable.
 
110
    """
 
111
    _decorate_docstring(callable, deprecation_version, label,
 
112
                        decorated_callable)
 
113
    decorated_callable.__name__ = callable.__name__