Улучшение читаемости кода
parent
07c77500e4
commit
724ec1040c
|
@ -9,11 +9,7 @@ from pyramid.path import (DottedNameResolver, AssetResolver)
|
|||
from pathlib import PurePath
|
||||
import yaml
|
||||
|
||||
from flatfilecms.models import (
|
||||
Folder,
|
||||
Document,
|
||||
IMarkdown,
|
||||
Jinja2,
|
||||
from flatfilecms.models import (Folder, Document, IMarkdown, Jinja2,
|
||||
LoaderFactory)
|
||||
|
||||
|
||||
|
@ -62,21 +58,16 @@ class PagesView:
|
|||
if 'menu' not in post:
|
||||
post['menu'] = yaml.load(
|
||||
AssetResolver().resolve(
|
||||
str(PurePath(self.context.data_path) /
|
||||
str(
|
||||
PurePath(self.context.data_path) /
|
||||
'menu/default.yaml')).stream(),
|
||||
LoaderFactory(self.context.data_path))
|
||||
return render_to_response(
|
||||
'{0}.jinja2'.format(
|
||||
post.get('template', 'default')),
|
||||
'{0}.jinja2'.format(post.get('template', 'default')),
|
||||
post,
|
||||
request=self.request,
|
||||
response=self.request.response
|
||||
)
|
||||
response=self.request.response)
|
||||
|
||||
@view_config(context=Jinja2)
|
||||
def jinja2(self):
|
||||
return render_to_response(
|
||||
self.context.path,
|
||||
{},
|
||||
request=self.request
|
||||
)
|
||||
return render_to_response(self.context.path, {}, request=self.request)
|
||||
|
|
Reference in New Issue