summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-04-10 17:56:15 +0200
committerJulian Andres Klode <jak@debian.org>2009-04-10 17:56:15 +0200
commitd7e542cd8973684d110c0512a49981e672df23e1 (patch)
tree9dfe7f17b301ccd4a320846cc4333d9007c5e4d8 /apt
parent5e5eb8e3d1942fe3a184c72811ee149b301a37b0 (diff)
downloadpython-apt-d7e542cd8973684d110c0512a49981e672df23e1.tar.gz
* apt/package.py(DeprecatedProperty.__get__): Only warn when used on objects.
This makes it easier to use e.g. pydoc,sphinx,pychecker, which use inspect the classes and therefore also have to access the properties.
Diffstat (limited to 'apt')
-rw-r--r--apt/package.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/apt/package.py b/apt/package.py
index 008aebae..00f563e4 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -99,10 +99,11 @@ class DeprecatedProperty(property):
self.__doc__ = ':Deprecated: ' + (doc or fget.__doc__ or '')
def __get__(self, obj, type=None):
- warnings.warn("Accessed deprecated property %s.%s, please see the "
- "Version class for alternatives." %
- ((obj.__class__.__name__ or type.__name__),
- self.fget.func_name), DeprecationWarning, 2)
+ if obj is not None:
+ warnings.warn("Accessed deprecated property %s.%s, please see the "
+ "Version class for alternatives." %
+ ((obj.__class__.__name__ or type.__name__),
+ self.fget.func_name), DeprecationWarning, 2)
return property.__get__(self, obj, type)