Projet

Général

Profil

« Précédent | Suivant » 

Révision cb4c30bc

Ajouté par Frédéric Péters il y a plus d'un an

misc: remove code that was used by old theming (#71998)

Voir les différences:

auquotidien/modules/template.py
1
from quixote import get_request, get_publisher, get_response
2
from qommon.publisher import get_publisher_class
3
from quixote.html import htmltext
4

  
5
from wcs.qommon import _, N_
6 1
from wcs.qommon import template
7
from wcs.qommon.admin.texts import TextsDirectory
8
from wcs.categories import Category
9 2

  
10 3
wcs_get_decorate_vars = template.get_decorate_vars
11 4

  
......
22 15
    return wcs_get_decorate_vars(body, response, generate_breadcrumb)
23 16

  
24 17

  
25
def render_response(publisher, body):
26
    response = get_response()
27

  
28
    if isinstance(body, template.QommonTemplateResponse):
29
        body = template.render(body.templates, body.context)
30
    body = str(body)
31

  
32
    root_url = publisher.get_root_url()
33
    wcs_path = publisher.get_request().get_path()[len(root_url) :]
34
    section = wcs_path.split('/')[0]
35

  
36
    if section in ('backoffice', 'admin'):
37
        return template.decorate(body, response)
38

  
39
    section_title = ''
40
    page_title = response.filter.get('title')
41
    if 'error-page' in response.filter:
42
        pass
43
    elif section == 'consultations':
44
        section_title = '<h2 id="consultations">%s</h2>\n' % _('Consultations')
45
        response.filter['bigdiv'] = 'rub_consultation'
46
    elif section and len(section) > 1:
47
        # XXX: this works but is not efficient
48
        if Category.has_urlname(section):
49
            section_title = '<h2 id="services">%s</h2>\n' % _('Services')
50
            response.filter['bigdiv'] = 'rub_service'
51

  
52
    if hasattr(response, 'breadcrumb') and response.breadcrumb:
53
        if len(response.breadcrumb) == 1:
54
            response.breadcrumb = None
55

  
56
    return template.decorate(body, response)
57

  
58

  
59 18
template.get_decorate_vars = get_decorate_vars
60
get_publisher_class().render_response = render_response
61

  
62
TextsDirectory.register('aq-error-assistance', N_('Assistance text next to errors'))

Formats disponibles : Unified diff