Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Timeout setting #89

Merged
merged 1 commit into from

2 participants

@nschwane

Added a timeout setting to use with urllib2 when retrieving an image with a URL. Without the timeout setting, urllib2 will wait indefinitely for a response.

@nschwane nschwane Added a timeout setting to use with urllib2 when retrieving an image …
…with a URL. Without the timeout setting, urllib2 will wait indefinitely for a response.
272bf5f
@mariocesar mariocesar merged commit 272bf5f into mariocesar:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2012
  1. @nschwane

    Added a timeout setting to use with urllib2 when retrieving an image …

    nschwane authored
    …with a URL. Without the timeout setting, urllib2 will wait indefinitely for a response.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +3 −0  sorl/thumbnail/conf/defaults.py
  2. +1 −1  sorl/thumbnail/images.py
View
3  sorl/thumbnail/conf/defaults.py
@@ -81,3 +81,6 @@
# or height given
THUMBNAIL_DUMMY_RATIO = 1.5
+# Timeout, in seconds, to use when retrieving images with urllib2
+THUMBNAIL_URL_TIMEOUT = None
+
View
2  sorl/thumbnail/images.py
@@ -166,7 +166,7 @@ def url(self):
class UrlStorage(Storage):
def open(self, name):
- return urllib2.urlopen(name)
+ return urllib2.urlopen(name, None, settings.THUMBNAIL_URL_TIMEOUT)
def exists(self, name):
try:
Something went wrong with that request. Please try again.