Projet

Général

Profil

0001-misc-don-t-display-captcha-option-by-default-10168.patch

Frédéric Péters, 02 mars 2016 21:44

Télécharger (2,59 ko)

Voir les différences:

Subject: [PATCH] misc: don't display captcha option by default (#10168)

 tests/test_admin_pages.py | 1 +
 tests/utilities.py        | 9 ++++++---
 wcs/admin/forms.py        | 9 +++++----
 3 files changed, 12 insertions(+), 7 deletions(-)
tests/test_admin_pages.py
805 805
    assert FormDef.get(1).fields[1].label == '1st field'
806 806

  
807 807
def test_form_edit_field(pub):
808
    create_superuser(pub)
808 809
    create_role()
809 810

  
810 811
    FormDef.wipe()
tests/utilities.py
94 94
        return pub
95 95

  
96 96
    os.mkdir(pub.app_dir)
97
    fd = file(os.path.join(pub.app_dir, 'site-options.cfg'), 'w')
98
    fd.write('[options]\n')
99
    fd.write('formdef-captcha-option = true\n')
97 100
    if sql_mode:
98
        fd = file(os.path.join(pub.app_dir, 'site-options.cfg'), 'w')
99
        fd.write('[options]\npostgresql = true\n')
100
        fd.close()
101
        fd.write('postgresql = true\n')
101 102
        conn = psycopg2.connect(user=os.environ['USER'])
102 103
        conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
103 104
        cur = conn.cursor()
......
114 115

  
115 116
        conn.close()
116 117

  
118
    fd.close()
119

  
117 120
    return pub
118 121

  
119 122
def clean_temporary_pub():
wcs/admin/forms.py
458 458
                self.formdef.enable_tracking_codes and
459 459
                C_('tracking code|Enabled') or C_('tracking code|Disabled'))
460 460

  
461
        r += add_option_line('options/captcha',
462
                _('CAPTCHA for anonymous users'),
463
                self.formdef.has_captcha and
464
                C_('captcha|Enabled') or C_('captcha|Disabled'))
461
        if get_publisher().has_site_option('formdef-captcha-option'):
462
            r += add_option_line('options/captcha',
463
                    _('CAPTCHA for anonymous users'),
464
                    self.formdef.has_captcha and
465
                    C_('captcha|Enabled') or C_('captcha|Disabled'))
465 466

  
466 467
        online_status = C_('online status|Active')
467 468
        if self.formdef.disabled:
468
-