mirror of https://github.com/Mikaela/Limnoria.git
Removed some potentially bad things from this stupid module.
This commit is contained in:
parent
350f189041
commit
89c3737648
|
@ -533,8 +533,11 @@ def open_resource(source, etag=None, modified=None, agent=None, referrer=None):
|
||||||
if hasattr(source, "read"):
|
if hasattr(source, "read"):
|
||||||
return source
|
return source
|
||||||
|
|
||||||
if source == "-":
|
## Not appropriate. I wish this module advertised that it did this.
|
||||||
return sys.stdin
|
## Hah! Incidentally, even if it were appropriate, Mr. Pilgrim forgot to
|
||||||
|
## import sys. Double suckage!
|
||||||
|
## if source == "-":
|
||||||
|
## return sys.stdin
|
||||||
|
|
||||||
if not agent:
|
if not agent:
|
||||||
agent = USER_AGENT
|
agent = USER_AGENT
|
||||||
|
@ -555,16 +558,21 @@ def open_resource(source, etag=None, modified=None, agent=None, referrer=None):
|
||||||
return opener.open(request)
|
return opener.open(request)
|
||||||
except:
|
except:
|
||||||
# source is not a valid URL, but it might be a valid filename
|
# source is not a valid URL, but it might be a valid filename
|
||||||
|
# jemfinch: yeah, right. Like we're going to allow that. Eat
|
||||||
|
# this, Mark Pilgrim!
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# try to open with native open function (if source is a filename)
|
## # Dumb dumb dumb!
|
||||||
try:
|
## # try to open with native open function (if source is a filename)
|
||||||
return open(source)
|
## try:
|
||||||
except:
|
## return open(source)
|
||||||
pass
|
## except:
|
||||||
|
## pass
|
||||||
|
|
||||||
|
# This just feels icky to me, I'm not allowing it.
|
||||||
# treat source as string
|
# treat source as string
|
||||||
return StringIO.StringIO(str(source))
|
## return StringIO.StringIO(str(source))
|
||||||
|
return StringIO.StringIO('')
|
||||||
|
|
||||||
def get_etag(resource):
|
def get_etag(resource):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue