perfs: avoid events/links in critical path (#18965)

This commit is contained in:
Frédéric Péters 2017-09-26 10:24:30 +02:00
parent c6f0966900
commit e3abbabb23
1 changed files with 8 additions and 4 deletions

View File

@ -808,8 +808,10 @@ class AlternateRootDirectory(OldRootDirectory):
response.filter = {}
response.filter['auquotidien'] = True
response.filter['gauche'] = self.box_side(path)
response.filter['keywords'] = template.get_current_theme().get('keywords')
if not path or path[0] not in ('api', 'backoffice'):
# api & backoffice have no use for a side box
response.filter['gauche'] = self.box_side(path)
response.filter['keywords'] = template.get_current_theme().get('keywords')
get_publisher().substitutions.feed(self)
response.breadcrumb = [ ('', _('Home')) ]
@ -1103,7 +1105,8 @@ class AlternateRootDirectory(OldRootDirectory):
r += htmltext('<input type="submit" value="%s"/>') % _('Load')
r += htmltext('</form>')
r += self.links()
if get_cfg('aq-permissions', {}).get('links'):
r += self.links()
cats = Category.select(order_by = 'name')
cats = [x for x in cats if x.url_name != 'consultations' and x.get_homepage_position() == 'side']
@ -1117,7 +1120,8 @@ class AlternateRootDirectory(OldRootDirectory):
r += htmltext('</ul>')
r += htmltext('</div>')
if Event.keys(): # if there are events, add a link to the agenda
if get_cfg('aq-permissions', {}).get('events') and Event.keys():
# if there are events, add a link to the agenda
tags = get_cfg('misc', {}).get('event_tags')
if not tags:
tags = get_default_event_tags()