[Hejes-devel] [1503] Bugfix: blog/show crashes with no or invalid slug
hejes-devel at nytud.hu
hejes-devel at nytud.hu
Wed Sep 30 17:18:36 CEST 2015
Revision: 1503
Author: mihaltz
Date: 2015-09-30 17:18:36 +0200 (Wed, 30 Sep 2015)
Log Message:
-----------
Bugfix: blog/show crashes with no or invalid slug
Modified Paths:
--------------
trunk/web2py/applications/helyesiras_webdev/controllers/blog.py
trunk/web2py/applications/helyesiras_webdev/progress.log
trunk/web2py/applications/helyesiras_webdev/views/blog/show.html
Modified: trunk/web2py/applications/helyesiras_webdev/controllers/blog.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/controllers/blog.py 2015-09-30 14:44:14 UTC (rev 1502)
+++ trunk/web2py/applications/helyesiras_webdev/controllers/blog.py 2015-09-30 15:18:36 UTC (rev 1503)
@@ -70,13 +70,13 @@
cats = dbblog(dbblog.categories.showing == True).select(orderby=dbblog.categories.ordering)
tags = dbblog().select(dbblog.tags.ALL, orderby=dbblog.tags.name)
slug = request.args(0)
- if slug == None: # no arg: redirect to index
+ if slug is None: # no slug: redirect to index
redirect(URL(c='blog', f='index'))
rows = dbblog( (dbblog.posts.category==dbblog.categories.id) & (dbblog.posts.slug==slug)).select()
if len(rows) == 0: # post not found: redirect to index
redirect(URL(c='blog', f='index'))
return dict(categories=cats, tags=tags, post=rows.first())
- except:
+ except Exception as e:
global EXCEPTIONMSG
response.flash = EXCEPTIONMSG
return dict(categories=[], tags=[], post=None)
Modified: trunk/web2py/applications/helyesiras_webdev/progress.log
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/progress.log 2015-09-30 14:44:14 UTC (rev 1502)
+++ trunk/web2py/applications/helyesiras_webdev/progress.log 2015-09-30 15:18:36 UTC (rev 1503)
@@ -1530,3 +1530,19 @@
[2015-09-30 16:01:07] EDIT helyesiras_webdev/views/default/suggest.html: 0
[2015-09-30 16:01:44] EDIT helyesiras_webdev/views/default/suggest.html: 0
[2015-09-30 16:03:01] EDIT helyesiras_webdev/views/default/suggest.html: 0
+[2015-09-30 16:55:48] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 16:56:17] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 16:56:31] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 17:02:24] EDIT helyesiras_webdev/controllers/blog.py: 2
+[2015-09-30 17:02:29] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 17:03:56] EDIT helyesiras_webdev/controllers/blog.py: 1
+[2015-09-30 17:04:51] EDIT helyesiras_webdev/controllers/blog.py: 1
+[2015-09-30 17:08:15] EDIT helyesiras_webdev/views/blog/show.html: 0
+[2015-09-30 17:08:45] EDIT helyesiras_webdev/views/blog/show.html: 0
+[2015-09-30 17:09:35] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 17:10:42] EDIT helyesiras_webdev/controllers/blog.py: 1
+[2015-09-30 17:11:17] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 17:12:21] EDIT helyesiras_webdev/controllers/blog.py: -2
+[2015-09-30 17:12:37] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 17:13:10] EDIT helyesiras_webdev/controllers/blog.py: 0
+[2015-09-30 17:17:04] EDIT helyesiras_webdev/controllers/blog.py: -3
Modified: trunk/web2py/applications/helyesiras_webdev/views/blog/show.html
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/views/blog/show.html 2015-09-30 14:44:14 UTC (rev 1502)
+++ trunk/web2py/applications/helyesiras_webdev/views/blog/show.html 2015-09-30 15:18:36 UTC (rev 1503)
@@ -1,12 +1,12 @@
{{
response.title = 'Helyes blog – helyesiras.mta.hu'
-if post.posts.title:
- response.title = post.posts.title + ' – ' + response.title
+if post is not None:
+ response.title = post.posts.title + ' – ' + response.title
+ response.meta.description = 'Hírek, érdekességek, helyesírási kérdések - a helyesírás.mta.hu portál blogja'
+ response.meta.og_image = URL('static', 'blog/' + post.posts.image_filename, host=True)
+ import re
+ response.meta.description = re.sub(r'<[^<>]+>', '', MARKMIN(post.posts.lead).xml())
pass
-response.meta.description = 'Hírek, érdekességek, helyesírási kérdések - a helyesírás.mta.hu portál blogja'
-response.meta.og_image = URL('static', 'blog/' + post.posts.image_filename, host=True)
-import re
-response.meta.description = re.sub(r'<[^<>]+>', '', MARKMIN(post.posts.lead).xml())
}}
{{extend 'layout.html'}}
More information about the Hejes-devel
mailing list