Minimal fixes and cleanup.

This commit is contained in:
Georg Brandl 2010-07-16 23:13:44 +02:00
parent 03ab07a650
commit 950e41e22e
7 changed files with 5 additions and 10 deletions

View File

@ -12,7 +12,7 @@ from werkzeug import redirect, Response
from werkzeug.exceptions import NotFound
from lodgeit import local
from lodgeit.lib import antispam
from lodgeit.i18n import list_languages, _
from lodgeit.i18n import list_languages as i18n_list_languages, _
from lodgeit.utils import render_to_response
from lodgeit.models import Paste
from lodgeit.database import db
@ -176,9 +176,9 @@ class PasteController(object):
return resp
def set_language(self, lang='en'):
"""Minimal view that set's a different language. Redirects
"""Minimal view that sets a different language. Redirects
back to the page the user is coming from."""
for key, value in list_languages():
for key, value in i18n_list_languages():
if key == lang:
local.request.set_language(lang)
break

View File

@ -139,7 +139,6 @@ class TextLayer(Layer):
color = random_color(saturation=0.1, lumination=0.1)
self.text_color = color
self.transparency = random.randint(20, 60)
f = get_random_resource('fonts')
self.font = ImageFont.truetype(get_random_resource('fonts'),
random.randrange(min_size, max_size))

View File

@ -9,7 +9,6 @@
:license: BSD
"""
import re
from werkzeug import escape
_gcc_message_re = re.compile(r'''(?ux)

View File

@ -203,7 +203,6 @@ class DiffRenderer(object):
continue
for chunk in file['chunks']:
lineiter = iter(chunk)
first = True
try:
while True:
line = lineiter.next()

View File

@ -103,7 +103,7 @@ def preview_highlight(code, language, num=5):
parsed_code.index('<pre>', start) + num:
parsed_code.index('</pre>', start + 7)
].strip('\n').splitlines()
except (IndexError, ValueError), e:
except (IndexError, ValueError):
code = code.strip('\n').splitlines()
lines = code[:num]
if len(code) > num:

View File

@ -59,7 +59,6 @@ def generate_pagination(page, per_page, total, link_builder=None,
abs(page - num) < math.ceil(threshold / 2.0):
if result and result[-1] != ellipsis:
result.append(commata)
was_space = False
link = link_builder(num)
template = num == page and active or normal
result.append(template % {

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
import os
from werkzeug import script, run_simple, create_environ, run_wsgi_app
from werkzeug import script, create_environ, run_wsgi_app
from lodgeit import local
from lodgeit.application import make_app