From 6bd19c36de5d93c8f2f9a6946f5b0ceb3761e439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 19 Nov 2015 11:28:50 +0100 Subject: [PATCH] misc: always include custom texts in a
(#9027) --- tests/test_texts.py | 12 ++++++------ wcs/qommon/admin/texts.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_texts.py b/tests/test_texts.py index f708db3..b31da46 100644 --- a/tests/test_texts.py +++ b/tests/test_texts.py @@ -27,19 +27,19 @@ def test_get_html_text_unset(): def test_get_html_text_default(): TextsDirectory.register('foo2', 'Foo', default='Foo...') - assert TextsDirectory.get_html_text('foo2') == 'Foo...' + assert TextsDirectory.get_html_text('foo2') == '
Foo...
' def test_get_html_text_set(): TextsDirectory.register('foo3', 'Foo', default='Foo...') pub.cfg['texts'] = {'text-foo3': None} pub.write_cfg() - assert TextsDirectory.get_html_text('foo3') == 'Foo...' + assert TextsDirectory.get_html_text('foo3') == '
Foo...
' pub.cfg['texts'] = {'text-foo3': 'Bar...'} pub.write_cfg() - assert TextsDirectory.get_html_text('foo3') == '

Bar...

' + assert TextsDirectory.get_html_text('foo3') == '

Bar...

' pub.cfg['texts'] = {'text-foo3': '
Bar...
'} pub.write_cfg() - assert TextsDirectory.get_html_text('foo3') == '
Bar...
' + assert TextsDirectory.get_html_text('foo3') == '
Bar...
' def test_get_html_subst(): # test for variable substitution @@ -47,8 +47,8 @@ def test_get_html_subst(): pub.substitutions.feed(MockSubstitutionVariables()) pub.cfg['texts'] = {'text-foo4': '[bar]'} pub.write_cfg() - assert TextsDirectory.get_html_text('foo4') == '

Foobar

' + assert TextsDirectory.get_html_text('foo4') == '

Foobar

' pub.cfg['texts'] = {'text-foo4': '[foo]'} pub.write_cfg() - assert TextsDirectory.get_html_text('foo4') == '

1 < 3

' + assert TextsDirectory.get_html_text('foo4') == '

1 < 3

' diff --git a/wcs/qommon/admin/texts.py b/wcs/qommon/admin/texts.py index 964001f..1caf2dc 100644 --- a/wcs/qommon/admin/texts.py +++ b/wcs/qommon/admin/texts.py @@ -64,12 +64,12 @@ class TextsDirectory(Directory): get_response().add_javascript_code('var LIVE_EDIT_TOOLTIP = "%s";\n' % \ _('Double click to edit the text')) get_response().add_css_include('../js/smoothness/jquery-ui-1.10.0.custom.min.css') - return htmltext('
'\ + return htmltext('
'\ '%s'\ '
'\ '%s'\ - '
' % (root_url, key, _('Edit This Text'), text)) - return htmltext(text) + '
' % (key, root_url, key, _('Edit This Text'), text)) + return htmltext('
%s
' % (key, text)) get_html_text = classmethod(get_html_text) def register(cls, key, description, hint=None, default=None, -- 2.6.2