Fix issue #66 and 2 other typos.

This commit is contained in:
florentx 2010-06-18 15:42:43 +08:00 committed by Armin Ronacher
parent 5abc9d5b20
commit a260cc3bfb
3 changed files with 8 additions and 6 deletions

View file

@ -10,15 +10,18 @@ app.secret_key = config.SECRET_KEY
from flask_website.openid_auth import DatabaseOpenIDStore from flask_website.openid_auth import DatabaseOpenIDStore
oid = OpenID(store_factory=DatabaseOpenIDStore) oid = OpenID(store_factory=DatabaseOpenIDStore)
@app.errorhandler(404) @app.errorhandler(404)
def not_found(error): def not_found(error):
return render_template('404.html'), 404 return render_template('404.html'), 404
@app.before_request @app.before_request
def load_currrent_user(): def load_current_user():
g.user = User.query.filter_by(openid=session['openid']).first() \ g.user = User.query.filter_by(openid=session['openid']).first() \
if 'openid' in session else None if 'openid' in session else None
@app.after_request @app.after_request
def remove_db_session(response): def remove_db_session(response):
db_session.remove() db_session.remove()

View file

@ -86,7 +86,7 @@ def hello():
<p> <p>
What people say about Flask on <a href=http://twitter.com/>Twitter</a>: What people say about Flask on <a href=http://twitter.com/>Twitter</a>:
{{ tweet_box(tweets, 3) }} {{ tweet_box(tweets, 3) }}
<p class=more><a href="{{ url_for('community.twitter') }}">more &raquo;<a> <p class=more><a href="{{ url_for('community.twitter') }}">more &raquo;</a>
{% endif %} {% endif %}
<a href="http://github.com/mitsuhiko/flask"><img style="position: fixed; top: 0; right: 0; border: 0;" <a href="http://github.com/mitsuhiko/flask"><img style="position: fixed; top: 0; right: 0; border: 0;"

View file

@ -84,10 +84,9 @@ def archive(page):
threads = all_threads[offset:offset + config.THREADS_PER_PAGE] threads = all_threads[offset:offset + config.THREADS_PER_PAGE]
if page != 1 and not threads: if page != 1 and not threads:
abort(404) abort(404)
page_count = int(ceil(len(all_threads) // float(config.THREADS_PER_PAGE)))
return render_template('mailinglist/archive.html', return render_template('mailinglist/archive.html',
page_count=int(ceil(len(all_threads) / page_count=page_count, page=page, threads=threads)
float(config.THREADS_PER_PAGE))),
page=page, threads=threads)
@mailinglist.route('/archive/<int:year>/<int:month>/<int:day>/<slug>/') @mailinglist.route('/archive/<int:year>/<int:month>/<int:day>/<slug>/')