diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-09 23:44:09 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-09 23:44:09 +0100 |
| commit | 2cf883a2512c5b5248d6bce5b7baed72abc1b99d (patch) | |
| tree | 7da473422772364e66114a15068b5fd6f17e237c /famille.py | |
| parent | 76d58425de6a1e3505c777921b1e58bf03370366 (diff) | |
| download | famille-flask-2cf883a2512c5b5248d6bce5b7baed72abc1b99d.tar.gz | |
Fix two bugs
* make the shortening function backward compatible to old comments
* fix a bug where the show_user function would always display the current user's
profile
Diffstat (limited to 'famille.py')
| -rw-r--r-- | famille.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -22,7 +22,10 @@ app.config.from_envvar('CONF') @app.template_filter('shortify') def shortify(string): soup = BeautifulSoup(string) - return soup("p")[0].get_text()[:50] + try: + return soup("p")[0].get_text()[:50] + except IndexError: + return string @app.template_filter('format_date') def format_date(datetime_string, format=u"%a %d %b %Y à %Hh%M".encode("utf8")): @@ -139,7 +142,7 @@ def edit_news(news_id): @app.route('/user/<int:user_id>/') @login_required def view_user(user_id): - user = query_db('SELECT * FROM users WHERE id= ?', (session['user_id'],), True) + user = query_db('SELECT * FROM users WHERE id= ?', (user_id,), True) return render_template("user/show.html", user=user) @app.route('/user/edit/', methods=['GET', 'POST']) |
