Minimal fixes and cleanup.
This commit is contained in:
parent
03ab07a650
commit
950e41e22e
@ -12,7 +12,7 @@ from werkzeug import redirect, Response
|
|||||||
from werkzeug.exceptions import NotFound
|
from werkzeug.exceptions import NotFound
|
||||||
from lodgeit import local
|
from lodgeit import local
|
||||||
from lodgeit.lib import antispam
|
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.utils import render_to_response
|
||||||
from lodgeit.models import Paste
|
from lodgeit.models import Paste
|
||||||
from lodgeit.database import db
|
from lodgeit.database import db
|
||||||
@ -176,9 +176,9 @@ class PasteController(object):
|
|||||||
return resp
|
return resp
|
||||||
|
|
||||||
def set_language(self, lang='en'):
|
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."""
|
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:
|
if key == lang:
|
||||||
local.request.set_language(lang)
|
local.request.set_language(lang)
|
||||||
break
|
break
|
||||||
|
@ -139,7 +139,6 @@ class TextLayer(Layer):
|
|||||||
color = random_color(saturation=0.1, lumination=0.1)
|
color = random_color(saturation=0.1, lumination=0.1)
|
||||||
self.text_color = color
|
self.text_color = color
|
||||||
self.transparency = random.randint(20, 60)
|
self.transparency = random.randint(20, 60)
|
||||||
f = get_random_resource('fonts')
|
|
||||||
self.font = ImageFont.truetype(get_random_resource('fonts'),
|
self.font = ImageFont.truetype(get_random_resource('fonts'),
|
||||||
random.randrange(min_size, max_size))
|
random.randrange(min_size, max_size))
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
:license: BSD
|
:license: BSD
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from werkzeug import escape
|
|
||||||
|
|
||||||
|
|
||||||
_gcc_message_re = re.compile(r'''(?ux)
|
_gcc_message_re = re.compile(r'''(?ux)
|
||||||
|
@ -203,7 +203,6 @@ class DiffRenderer(object):
|
|||||||
continue
|
continue
|
||||||
for chunk in file['chunks']:
|
for chunk in file['chunks']:
|
||||||
lineiter = iter(chunk)
|
lineiter = iter(chunk)
|
||||||
first = True
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
line = lineiter.next()
|
line = lineiter.next()
|
||||||
|
@ -103,7 +103,7 @@ def preview_highlight(code, language, num=5):
|
|||||||
parsed_code.index('<pre>', start) + num:
|
parsed_code.index('<pre>', start) + num:
|
||||||
parsed_code.index('</pre>', start + 7)
|
parsed_code.index('</pre>', start + 7)
|
||||||
].strip('\n').splitlines()
|
].strip('\n').splitlines()
|
||||||
except (IndexError, ValueError), e:
|
except (IndexError, ValueError):
|
||||||
code = code.strip('\n').splitlines()
|
code = code.strip('\n').splitlines()
|
||||||
lines = code[:num]
|
lines = code[:num]
|
||||||
if len(code) > num:
|
if len(code) > num:
|
||||||
|
@ -59,7 +59,6 @@ def generate_pagination(page, per_page, total, link_builder=None,
|
|||||||
abs(page - num) < math.ceil(threshold / 2.0):
|
abs(page - num) < math.ceil(threshold / 2.0):
|
||||||
if result and result[-1] != ellipsis:
|
if result and result[-1] != ellipsis:
|
||||||
result.append(commata)
|
result.append(commata)
|
||||||
was_space = False
|
|
||||||
link = link_builder(num)
|
link = link_builder(num)
|
||||||
template = num == page and active or normal
|
template = num == page and active or normal
|
||||||
result.append(template % {
|
result.append(template % {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/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 import local
|
||||||
from lodgeit.application import make_app
|
from lodgeit.application import make_app
|
||||||
|
Loading…
Reference in New Issue
Block a user