Merge branch 'website' of github.com:mitsuhiko/flask into website
This commit is contained in:
commit
d7d99fae59
2 changed files with 7 additions and 5 deletions
|
|
@ -10,15 +10,18 @@ app.secret_key = config.SECRET_KEY
|
|||
from flask_website.openid_auth import DatabaseOpenIDStore
|
||||
oid = OpenID(store_factory=DatabaseOpenIDStore)
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(error):
|
||||
return render_template('404.html'), 404
|
||||
|
||||
|
||||
@app.before_request
|
||||
def load_currrent_user():
|
||||
def load_current_user():
|
||||
g.user = User.query.filter_by(openid=session['openid']).first() \
|
||||
if 'openid' in session else None
|
||||
|
||||
|
||||
@app.after_request
|
||||
def remove_db_session(response):
|
||||
db_session.remove()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Mail(object):
|
|||
in_sig = False
|
||||
for line in split_lines_wrapping(self.text):
|
||||
if line == u'-- ':
|
||||
in_sig = True
|
||||
in_sig = True
|
||||
if in_sig:
|
||||
line = Markup(u'<span class=sig>%s</span>') % line
|
||||
elif line.startswith('>'):
|
||||
|
|
@ -84,10 +84,9 @@ def archive(page):
|
|||
threads = all_threads[offset:offset + config.THREADS_PER_PAGE]
|
||||
if page != 1 and not threads:
|
||||
abort(404)
|
||||
page_count = int(ceil(len(all_threads) // float(config.THREADS_PER_PAGE)))
|
||||
return render_template('mailinglist/archive.html',
|
||||
page_count=int(ceil(len(all_threads) /
|
||||
float(config.THREADS_PER_PAGE))),
|
||||
page=page, threads=threads)
|
||||
page_count=page_count, page=page, threads=threads)
|
||||
|
||||
|
||||
@mailinglist.route('/archive/<int:year>/<int:month>/<int:day>/<slug>/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue