forked from feincms/feincms
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontext_processors.py
More file actions
27 lines (22 loc) · 880 Bytes
/
Copy pathcontext_processors.py
File metadata and controls
27 lines (22 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from feincms.module.page.models import Page
def add_page_if_missing(request):
# If this attribute exists, the a page object has been registered already
# by some other part of the code. We let it decide, which page object it
# wants to pass into the template
if hasattr(request, '_feincms_page'):
return {}
try:
return {
'feincms_page': Page.objects.best_match_for_request(request),
}
except Page.DoesNotExist:
return {}
def appcontent_parameters(request):
"""Add ApplicationContent parameters from the request
ApplicationContent adds the parameters to the request object before
processing the view so we can expose them to templates here
"""
if not hasattr(request, '_feincms_appcontent_parameters'):
return {}
else:
return request._feincms_appcontent_parameters