From 950e41e22e2811468664edbb56d12a83c9e70345 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 16 Jul 2010 23:13:44 +0200 Subject: [PATCH] Minimal fixes and cleanup. --- lodgeit/controllers/pastes.py | 6 +++--- lodgeit/lib/captcha.py | 1 - lodgeit/lib/compilerparser.py | 1 - lodgeit/lib/diff.py | 1 - lodgeit/lib/highlighting.py | 2 +- lodgeit/lib/pagination.py | 1 - manage.py | 3 +-- 7 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lodgeit/controllers/pastes.py b/lodgeit/controllers/pastes.py index 8123cb4..5ee49ab 100644 --- a/lodgeit/controllers/pastes.py +++ b/lodgeit/controllers/pastes.py @@ -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 diff --git a/lodgeit/lib/captcha.py b/lodgeit/lib/captcha.py index ba802e4..7ec2111 100644 --- a/lodgeit/lib/captcha.py +++ b/lodgeit/lib/captcha.py @@ -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)) diff --git a/lodgeit/lib/compilerparser.py b/lodgeit/lib/compilerparser.py index 4d3d2c2..1459fc8 100644 --- a/lodgeit/lib/compilerparser.py +++ b/lodgeit/lib/compilerparser.py @@ -9,7 +9,6 @@ :license: BSD """ import re -from werkzeug import escape _gcc_message_re = re.compile(r'''(?ux) diff --git a/lodgeit/lib/diff.py b/lodgeit/lib/diff.py index 0b8abbc..eebbcbe 100644 --- a/lodgeit/lib/diff.py +++ b/lodgeit/lib/diff.py @@ -203,7 +203,6 @@ class DiffRenderer(object): continue for chunk in file['chunks']: lineiter = iter(chunk) - first = True try: while True: line = lineiter.next() diff --git a/lodgeit/lib/highlighting.py b/lodgeit/lib/highlighting.py index 60ea7ed..ecedc38 100644 --- a/lodgeit/lib/highlighting.py +++ b/lodgeit/lib/highlighting.py @@ -103,7 +103,7 @@ def preview_highlight(code, language, num=5): parsed_code.index('
', start) + num:
             parsed_code.index('
', start + 7) ].strip('\n').splitlines() - except (IndexError, ValueError), e: + except (IndexError, ValueError): code = code.strip('\n').splitlines() lines = code[:num] if len(code) > num: diff --git a/lodgeit/lib/pagination.py b/lodgeit/lib/pagination.py index 89864db..7d4e877 100644 --- a/lodgeit/lib/pagination.py +++ b/lodgeit/lib/pagination.py @@ -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 % { diff --git a/manage.py b/manage.py index 50586af..05a774b 100755 --- a/manage.py +++ b/manage.py @@ -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