PEP8, various other tweaks

This commit is contained in:
Luke Rogers 2012-09-05 07:52:03 +12:00
parent 6c022dac1c
commit e12e7721da
11 changed files with 29 additions and 34 deletions

View file

@ -14,8 +14,8 @@ def eval_py(code, paste_multiline=True):
status = "Python error: "
else:
status = "Code executed sucessfully: "
if "\n" in output and paste_multiline:
return status + web.haste(output)
else:
return output
return output

View file

@ -103,4 +103,4 @@ def quote(s):
def unescape(s):
if not s.strip():
return s
return html.fromstring(s).text_content()
return html.fromstring(s).text_content()

View file

@ -104,8 +104,10 @@ def get_text_list(list_, last_word='or'):
>>> get_text_list([])
u''
"""
if len(list_) == 0: return ''
if len(list_) == 1: return list_[0]
if len(list_) == 0:
return ''
if len(list_) == 1:
return list_[0]
return '%s %s %s' % (
# Translators: This string is used as a separator between list elements
(', ').join([i for i in list_][:-1]),

View file

@ -10,7 +10,7 @@ paste_url = "http://paste.dmptr.com"
def isgd(url):
""" shortens a URL with the is.gd PAI """
url = urlnorm.normalize(url.encode('utf-8'))
params = urllib.urlencode({'format': 'simple', 'url': url})
params = urllib.urlencode({'format': 'simple', 'url': url})
return http.get("http://is.gd/create.php?%s" % params)
@ -19,4 +19,4 @@ def haste(text):
request = urllib2.Request(paste_url + "/documents", text)
response = urllib2.urlopen(request)
data = json.loads(response.read())
return("%s/%s.txt" % (paste_url, data['key']))
return("%s/%s.txt" % (paste_url, data['key']))