Projet

Général

Profil

0001-misc-apply-new-limits-66421.patch

Frédéric Péters, 21 juin 2022 07:44

Télécharger (6,5 ko)

Voir les différences:

Subject: [PATCH] misc: apply new limits (#66421)

 tests/admin_pages/test_block.py | 8 ++++----
 tests/admin_pages/test_card.py  | 4 ++--
 tests/admin_pages/test_form.py  | 4 ++--
 wcs/admin/blocks.py             | 4 ++--
 wcs/admin/fields.py             | 2 +-
 wcs/admin/workflows.py          | 8 ++++----
 wcs/wf/form.py                  | 4 ++--
 7 files changed, 17 insertions(+), 17 deletions(-)
tests/admin_pages/test_block.py
425 425
    assert 'more than 20 fields' not in resp.text
426 426

  
427 427
    blockdef.fields.extend(
428
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(10, 21)]
428
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(10, 31)]
429 429
    )
430 430
    blockdef.store()
431 431
    resp = app.get('/backoffice/forms/blocks/%s/' % blockdef.id)
432
    assert 'more than 20 fields' not in resp.text
432
    assert 'more than 30 fields' not in resp.text
433 433
    assert '<div id="new-field"><h3>New Field</h3>' in resp.text
434 434
    assert '>Duplicate<' in resp.text
435 435

  
436 436
    blockdef.fields.extend(
437
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(21, 31)]
437
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(21, 51)]
438 438
    )
439 439
    blockdef.store()
440 440
    resp = app.get('/backoffice/forms/blocks/%s/' % blockdef.id)
441
    assert 'This block of fields contains 30 fields.' in resp.text
441
    assert 'This block of fields contains 60 fields.' in resp.text
442 442
    assert '<div id="new-field"><h3>New Field</h3>' not in resp.text
443 443
    assert '>Duplicate<' not in resp.text
444 444

  
tests/admin_pages/test_card.py
914 914
    assert '>Duplicate<' in resp.text
915 915

  
916 916
    carddef.fields.extend(
917
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 310)]
917
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 410)]
918 918
    )
919 919
    carddef.store()
920 920
    resp = app.get('/backoffice/cards/%s/fields/' % carddef.id)
921
    assert 'This card model contains 310 fields.' in resp.text
921
    assert 'This card model contains 410 fields.' in resp.text
922 922
    assert 'first field should be of type "page"' in resp.text
923 923
    assert '<div id="new-field"><h3>New Field</h3>' not in resp.text
924 924
    assert '>Duplicate<' not in resp.text
tests/admin_pages/test_form.py
2656 2656
    assert '>Duplicate<' in resp.text
2657 2657

  
2658 2658
    formdef.fields.extend(
2659
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 310)]
2659
        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 410)]
2660 2660
    )
2661 2661
    formdef.store()
2662 2662
    resp = app.get('/backoffice/forms/%s/fields/' % formdef.id)
2663
    assert 'This form contains 310 fields.' in resp.text
2663
    assert 'This form contains 410 fields.' in resp.text
2664 2664
    assert 'no new fields can be added.' in resp.text
2665 2665
    assert 'first field should be of type "page"' in resp.text
2666 2666
    assert '<div id="new-field"><h3>New Field</h3>' not in resp.text
wcs/admin/blocks.py
54 54

  
55 55
    field_count_message = _('This block of fields contains %d fields.')
56 56
    field_over_count_message = _('This block of fields contains more than %d fields.')
57
    fields_count_total_soft_limit = 20
58
    fields_count_total_hard_limit = 30
57
    fields_count_total_soft_limit = 30
58
    fields_count_total_hard_limit = 60
59 59

  
60 60
    def __init__(self, section='forms', *args, **kwargs):
61 61
        if kwargs.pop('component', None):  # snapshot
wcs/admin/fields.py
296 296

  
297 297
    support_import = True
298 298
    fields_count_total_soft_limit = 200
299
    fields_count_total_hard_limit = 300
299
    fields_count_total_hard_limit = 400
300 300

  
301 301
    def html_top(self, title, *args, **kwargs):
302 302
        html_top(self.section, title, *args, **kwargs)
wcs/admin/workflows.py
1056 1056

  
1057 1057
    field_count_message = _('This workflow contains %d variables.')
1058 1058
    field_over_count_message = _('This workflow contains more than %d variables.')
1059
    fields_count_total_soft_limit = 20
1060
    fields_count_total_hard_limit = 30
1059
    fields_count_total_soft_limit = 40
1060
    fields_count_total_hard_limit = 80
1061 1061

  
1062 1062
    def index_top(self):
1063 1063
        r = TemplateIO(html=True)
......
1084 1084
    new_field_history_message = _('New backoffice field "%s"')
1085 1085
    field_count_message = _('This workflow contains %d backoffice fields.')
1086 1086
    field_over_count_message = _('This workflow contains more than %d backoffice fields.')
1087
    fields_count_total_soft_limit = 30
1088
    fields_count_total_hard_limit = 45
1087
    fields_count_total_soft_limit = 40
1088
    fields_count_total_hard_limit = 80
1089 1089

  
1090 1090
    def index_top(self):
1091 1091
        r = TemplateIO(html=True)
wcs/wf/form.py
104 104
    support_import = False
105 105
    blacklisted_types = ['page', 'computed']
106 106
    field_def_page_class = WorkflowFormFieldDefPage
107
    fields_count_total_soft_limit = 20
108
    fields_count_total_hard_limit = 30
107
    fields_count_total_soft_limit = 40
108
    fields_count_total_hard_limit = 80
109 109

  
110 110

  
111 111
class FormWorkflowStatusItem(WorkflowStatusItem):
112
-