added setting.jinja2
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from pyramid.view import view_config
|
||||
from pyramid.httpexceptions import HTTPNotFound, HTTPFound
|
||||
from markdown2 import Markdown
|
||||
|
||||
from ..models.blog_record import BlogRecord
|
||||
from ..services.blog_record import BlogRecordService
|
||||
from ..forms import BlogCreateForm, BlogUpdateForm, BlogSearchForm
|
||||
@@ -15,13 +17,16 @@ def blog(request):
|
||||
request.session.flash(u"Page non trouvée : %s" % blog_id, 'warning')
|
||||
return HTTPFound(location=request.route_url('home'))
|
||||
|
||||
# just created ? convert body to html
|
||||
if entry.body_html == '':
|
||||
BlogRecordService.proc_after_create(request, blog_id)
|
||||
# insèrer le path de static/img
|
||||
body = entry.body.replace('static/img/', "%s/static/img/" % request.application_url)
|
||||
# convertir mardown en HTML
|
||||
markdowner = Markdown()
|
||||
body_html = markdowner.convert(body)
|
||||
|
||||
return {
|
||||
'page_title': entry.title,
|
||||
'entry': entry
|
||||
'entry': entry,
|
||||
'body_html': body_html,
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +124,7 @@ def topic(request):
|
||||
if items:
|
||||
liste += '<ul>'
|
||||
for item in items:
|
||||
liste += '<li>{0} <a href="{1}"><span class="glyphicon glyphicon-menu-right"></span>{2}</a></li>'.format(
|
||||
liste += '<li>{0} <a href="{1}"><span class="glyphicon glyphicon-menu-right"></span> {2}</a></li>'.format(
|
||||
item.edited.strftime("%d-%m-%Y"), request.route_url('blog', id=item.id, slug=item.slug), item.title)
|
||||
liste += '</ul>'
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user