Project

General

Profile

0001-remove-theme-keyword-variants-70129.patch

Frédéric Péters, 11 October 2022 06:22 PM

Download (3.34 KB)

View differences:

Subject: [PATCH] remove theme keyword variants (#70129)

 auquotidien/modules/root.py     | 13 -------------
 auquotidien/modules/template.py | 11 -----------
 tests/test_user_pages.py        |  4 ++--
 3 files changed, 2 insertions(+), 26 deletions(-)
auquotidien/modules/root.py
278 278
        if not path or (path[0] not in ('api', 'backoffice') and not get_request().is_json()):
279 279
            # api & backoffice have no use for a side box
280 280
            response.filter['gauche'] = lambda x: self.box_side(path)
281
            response.filter['keywords'] = template.get_current_theme().get('keywords')
282 281
        get_publisher().substitutions.feed(self)
283 282

  
284 283
        response.breadcrumb = [('', _('Home'))]
......
384 383
        r = TemplateIO(html=True)
385 384
        get_response().filter['is_index'] = True
386 385

  
387
        if not 'auquotidien-welcome-in-services' in get_response().filter.get('keywords', []):
388
            t = TextsDirectory.get_html_text('aq-home-page')
389
            if not t:
390
                if get_request().user:
391
                    t = TextsDirectory.get_html_text('welcome-logged')
392
                else:
393
                    t = TextsDirectory.get_html_text('welcome-unlogged')
394
            if t:
395
                r += htmltext('<div id="home-page-intro">')
396
                r += t
397
                r += htmltext('</div>')
398

  
399 386
        r += htmltext('<div id="centre">')
400 387
        r += self.box_services(position='1st')
401 388
        r += htmltext('</div>')
auquotidien/modules/template.py
49 49
            section_title = '<h2 id="services">%s</h2>\n' % _('Services')
50 50
            response.filter['bigdiv'] = 'rub_service'
51 51

  
52
    if not 'auquotidien-no-titles-in-section' in response.filter.get('keywords', []):
53
        if page_title:
54
            if section_title:
55
                page_title = '<h3>%s</h3>' % page_title
56
            else:
57
                page_title = '<h2 id="info">%s</h2>' % page_title
58
        else:
59
            page_title = ''
60

  
61
        body = '\n'.join((section_title, page_title, body))
62

  
63 52
    if hasattr(response, 'breadcrumb') and response.breadcrumb:
64 53
        if len(response.breadcrumb) == 1:
65 54
            response.breadcrumb = None
tests/test_user_pages.py
201 201
    assert resp.location == 'http://example.net/test/foobar/'
202 202
    resp = resp.follow()
203 203
    assert resp.form
204
    assert '<h3>foobar</h3>' in resp
204
    assert '<h1>foobar</h1>' in resp
205 205

  
206 206
    # check we get to the test form
207 207
    resp = get_app(pub).get('/test/')
208 208
    assert resp.form
209
    assert '<h3>test</h3>' in resp
209
    assert '<h1>test</h1>' in resp
210
-