diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-23 21:41:00 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-23 21:41:00 +0100 |
| commit | 82fda8b9fa514ed8a268650f21ae9e76d713e1d4 (patch) | |
| tree | 25b39616fde9dfe56da2097bdad12b5d1acc962e | |
| parent | 16917ac913f029aed5148bdb134069901c816300 (diff) | |
| download | python-apt-82fda8b9fa514ed8a268650f21ae9e76d713e1d4.tar.gz | |
* apt/package.py:
- make sure to set the defaulttimeout back to the
original value (in getChangelog(), LP: #314212)
| -rw-r--r-- | apt/package.py | 11 | ||||
| -rw-r--r-- | debian/changelog | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/apt/package.py b/apt/package.py index ecfd8b61..5a7da1f3 100644 --- a/apt/package.py +++ b/apt/package.py @@ -32,10 +32,6 @@ import apt_pkg __all__ = 'BaseDependency', 'Dependency', 'Origin', 'Package', 'Record' -# Set a timeout for the changelog download -socket.setdefaulttimeout(2) - - def _(string): """Return the translation of the string.""" return gettext.dgettext("python-apt", string) @@ -596,7 +592,12 @@ class Package(object): "prefix": prefix, "src_pkg": src_pkg, "src_ver": src_ver} + + timeout = socket.getdefaultimeout() try: + # Set a timeout for the changelog download + socket.setdefaulttimeout(2) + # Check if the download was canceled if cancel_lock and cancel_lock.isSet(): return "" @@ -649,6 +650,8 @@ class Package(object): except (IOError, httplib.BadStatusLine): return _("Failed to download the list of changes. \nPlease " "check your Internet connection.") + finally: + socket.setdefaulttimeout(timeout) return self._changelog @property diff --git a/debian/changelog b/debian/changelog index 73715a36..f3514680 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ python-apt (0.7.9~exp3) experimental; urgency=low InitConfig() again to ensure that the config from the rootdir is read, not from the host (lp: #243550) + * apt/package.py: + - make sure to set the defaulttimeout back to the + original value (in getChangelog(), LP: #314212) -- |
