diff --git a/ctp_blogr/views/default.py b/ctp_blogr/views/default.py index 6249cad..eaf909c 100644 --- a/ctp_blogr/views/default.py +++ b/ctp_blogr/views/default.py @@ -17,12 +17,19 @@ def home(request): last_ten = BlogRecordService.get_last_created(request) # get Chappatte cartoon entry = BlogRecordService.by_id(request, 95) + if entry: + cartoon_title = entry.title + cartoon_url = entry.body + else: + cartoon_title = "Cartoon non trouvé" + cartoon_url = "" + return { 'page_title': "This is the Way", 'last_ten': last_ten, - 'cartoon_title': entry.title, - 'cartoon_url': entry.body, + 'cartoon_title': cartoon_title, + 'cartoon_url': cartoon_url, } @@ -230,7 +237,7 @@ def user_edit(request): return HTTPFound(location=url_retour) if 'form.deleted' in request.params: - # check wether name is an admin + # check whether name is an admin if name in 'group:administrators' in request.effective_principals: request.session.flash("Il est interdit de supprimer un utisateur 'Admin'.", 'success') else: