LodgeIt gets a redesign for the summer time :-)

This commit is contained in:
mitsuhiko 2008-06-23 22:44:08 +02:00
parent 9c8104bd54
commit 0dc543a762
5 changed files with 35 additions and 29 deletions

View File

@ -20,9 +20,6 @@ from lodgeit.lib.pagination import generate_pagination
from lodgeit.lib.captcha import check_hashed_solution, Captcha
MAX_LINE_LENGTH = 300
class PasteController(BaseController):
"""Provides all the handler callback for paste related stuff."""
@ -173,4 +170,5 @@ class PasteController(BaseController):
"""Show a captcha."""
return Captcha().get_response(set_cookie=True)
controller = PasteController

View File

@ -5,10 +5,10 @@
Fight stupid spammers.
:copyright: 2007 by Armin Ronacher, Christopher Grebs.
2008 by Christopher Grebs.
:copyright: 2007-2008 by Armin Ronacher, Christopher Grebs.
:license: BSD
"""
from __future__ import division
import re
from operator import sub
from itertools import starmap
@ -22,10 +22,20 @@ _url_pattern = (
_link_re = re.compile(r'%s[^\s\'"]+\S' % _url_pattern)
# maximum number of links in percent
MAX_LINK_PERCENTAGE = 30
# maximum number of links in the text (hard limit)
MAX_LINK_NUMBER = 15
def check_for_link_spam(code):
"""It's spam if more than 30% of the text are links."""
spans = (x.span() for x in _link_re.finditer(code))
return (sum(starmap(sub, spans)) * -100) / (len(code) or 1) > 30
spans = [x.span() for x in _link_re.finditer(code)]
if len(spans) > MAX_LINK_PERCENTAGE:
return True
return (sum(starmap(sub, spans)) * -100) / (len(code) or 1) \
> MAX_LINK_PERCENTAGE
def is_spam(code):

View File

@ -7,7 +7,7 @@
PyCAPTCHA by Micah Dowty and was originally used in inyoka.
:copyright: Copyright 2007 by Armin Ronacher, Micah Dowty.
:copyright: Copyright 2007-2008 by Armin Ronacher, Micah Dowty.
:license: GNU GPL.
"""
import random

View File

@ -3,9 +3,7 @@
*/
body {
background-color: #021317;
background-image: url(pagebg.png);
background-repeat: repeat-x;
background: #C1DAE0;
margin: 0;
padding: 0;
font-family: 'Trebuchet MS', sans-serif;
@ -14,10 +12,9 @@ body {
div.page {
margin: 30px;
padding: 10px;
background-color: white;
background-image: url(background.png);
background-repeat: repeat-x;
padding: 14px;
background: white url(background.png) repeat-x;
border: 5px solid #A0CAD4;
}
div.footer {
@ -74,7 +71,7 @@ div.text {
#navigation li a {
display: block;
padding: 5px 10px 5px 10px;
background-color: #333;
background-color: #84BCCA;
text-decoration: none;
color: white;
font-size: 16px;
@ -92,7 +89,7 @@ div.text {
#paste {
margin: 0;
padding: 0;
border: 1px solid #333;
border: 1px solid #84BCCA;
}
#paste table, #paste tbody {
@ -107,7 +104,7 @@ div.text {
}
#paste td.linenos {
background-color: #333;
background-color: #84BCCA;
padding-right: 5px;
padding-left: 20px;
text-align: right;
@ -128,16 +125,16 @@ div.text {
div.related,
div.notification {
margin: 0 0 10px 0;
border: 1px solid #136276;
background-color: #333;
color: #fff;
border: 1px solid #84BCCA;
background-color: #D5E9EE;
color: #103842;
}
div.related h3,
div.notification h3 {
margin: 0;
padding: 0;
background-color: #136276;
background-color: #84BCCA;
font-size: 18px;
}
@ -150,9 +147,7 @@ div.related h3 a {
}
div.notification div.captcha {
background-color: #222;
margin: 10px;
padding: 10px;
}
div.notification div.captcha p {
@ -181,12 +176,12 @@ div.notification p {
div.related a,
div.notification a {
color: #ccc;
color: #136276;
}
div.related a:hover,
div.notification a:hover {
color: #aaa;
color: #1d89a4;
}
div.related ul {
@ -195,11 +190,15 @@ div.related ul {
}
input, select, textarea {
border: 1px solid #0b4553;
border: 1px solid #A0CAD4;
font-family: 'Trebuchet MS', sans-serif;
font-size: 15px;
color: black;
background-color: #f2f2f2;
background-color: #FAFEFF;
}
input:focus, select:focus, textarea:focus {
outline: 1px solid #41A0B8;
}
textarea {

View File

@ -37,7 +37,6 @@
</p>
<h3 id="software-used">Software Used</h3>
<ul>
<li><a href="http://www.sqlite.org/">sqlite3</a> as database</li>
<li><a href="http://pygments.pocoo.org/">Pygments</a> for syntax highlighting</li>
<li><a href="http://www.python.org/">Python</a> as scripting language</li>
<li><a href="http://jinja.pocoo.org/2">Jinja 2</a> for templating</li>