misc: remove fields-blocks site option (#57260)
This commit is contained in:
parent
4d9e132798
commit
d44e1e84cf
|
@ -34,7 +34,7 @@ def teardown_module(module):
|
|||
clean_temporary_pub()
|
||||
|
||||
|
||||
def test_block_404(pub, blocks_feature):
|
||||
def test_block_404(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
BlockDef.wipe()
|
||||
|
@ -42,7 +42,7 @@ def test_block_404(pub, blocks_feature):
|
|||
app.get('/backoffice/forms/blocks/1/', status=404)
|
||||
|
||||
|
||||
def test_block_new(pub, blocks_feature):
|
||||
def test_block_new(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
BlockDef.wipe()
|
||||
|
@ -73,7 +73,7 @@ def test_block_new(pub, blocks_feature):
|
|||
assert str(BlockDef.get(1).fields[0].id) != '1' # don't use integers
|
||||
|
||||
|
||||
def test_block_options(pub, blocks_feature):
|
||||
def test_block_options(pub):
|
||||
create_superuser(pub)
|
||||
BlockDef.wipe()
|
||||
block = BlockDef()
|
||||
|
@ -104,7 +104,7 @@ def test_block_options(pub, blocks_feature):
|
|||
resp = resp.follow()
|
||||
|
||||
|
||||
def test_block_options_digest_template(pub, blocks_feature):
|
||||
def test_block_options_digest_template(pub):
|
||||
create_superuser(pub)
|
||||
BlockDef.wipe()
|
||||
block = BlockDef()
|
||||
|
@ -130,7 +130,7 @@ def test_block_options_digest_template(pub, blocks_feature):
|
|||
assert block.digest_template == 'X{{foobar_var_foo}}Y'
|
||||
|
||||
|
||||
def test_block_export_import(pub, blocks_feature):
|
||||
def test_block_export_import(pub):
|
||||
create_superuser(pub)
|
||||
BlockDef.wipe()
|
||||
block = BlockDef()
|
||||
|
@ -177,7 +177,7 @@ def test_block_export_import(pub, blocks_feature):
|
|||
assert 'Invalid File' in resp
|
||||
|
||||
|
||||
def test_block_delete(pub, blocks_feature):
|
||||
def test_block_delete(pub):
|
||||
create_superuser(pub)
|
||||
BlockDef.wipe()
|
||||
FormDef.wipe()
|
||||
|
@ -213,7 +213,7 @@ def test_block_delete(pub, blocks_feature):
|
|||
assert 'This block is still used' in resp
|
||||
|
||||
|
||||
def test_block_edit_duplicate_delete_field(pub, blocks_feature):
|
||||
def test_block_edit_duplicate_delete_field(pub):
|
||||
create_superuser(pub)
|
||||
BlockDef.wipe()
|
||||
block = BlockDef()
|
||||
|
@ -241,7 +241,7 @@ def test_block_edit_duplicate_delete_field(pub, blocks_feature):
|
|||
assert len(BlockDef.get(block.id).fields) == 1
|
||||
|
||||
|
||||
def test_block_use_in_formdef(pub, blocks_feature):
|
||||
def test_block_use_in_formdef(pub):
|
||||
create_superuser(pub)
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
|
|
@ -541,7 +541,7 @@ def test_backoffice_cards_wscall_failure_display(http_requests, pub):
|
|||
assert pub.loggederror_class.select()[0].get_formdata().data == {'1': 'plop'}
|
||||
|
||||
|
||||
def test_block_card_item_link(pub, blocks_feature):
|
||||
def test_block_card_item_link(pub):
|
||||
user = create_user(pub)
|
||||
CardDef.wipe()
|
||||
carddef = CardDef()
|
||||
|
|
|
@ -52,11 +52,6 @@ def welco_url(request, pub):
|
|||
return site_options(request, pub, 'options', 'welco_url', 'http://welco.example.net')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def blocks_feature(request, pub):
|
||||
return site_options(request, pub, 'options', 'fields-blocks', 'true')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def emails():
|
||||
with EmailsMocking() as mock:
|
||||
|
|
|
@ -44,7 +44,7 @@ def teardown_module(module):
|
|||
clean_temporary_pub()
|
||||
|
||||
|
||||
def test_block_simple(pub, blocks_feature):
|
||||
def test_block_simple(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -79,7 +79,7 @@ def test_block_simple(pub, blocks_feature):
|
|||
assert '>bar<' in resp
|
||||
|
||||
|
||||
def test_block_required(pub, blocks_feature):
|
||||
def test_block_required(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -145,7 +145,7 @@ def test_block_required(pub, blocks_feature):
|
|||
assert 'Check values then click submit.' in resp.text
|
||||
|
||||
|
||||
def test_block_required_previous_page(pub, blocks_feature):
|
||||
def test_block_required_previous_page(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -243,7 +243,7 @@ def test_block_required_previous_page(pub, blocks_feature):
|
|||
assert formdata.data['1']['data'] == [{'123': 'foo', '234': 'bar'}, {'123': 'foo2', '234': 'bar2'}]
|
||||
|
||||
|
||||
def test_block_date(pub, blocks_feature):
|
||||
def test_block_date(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -273,7 +273,7 @@ def test_block_date(pub, blocks_feature):
|
|||
assert '>2020-06-16<' in resp
|
||||
|
||||
|
||||
def test_block_bool(pub, blocks_feature):
|
||||
def test_block_bool(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -309,7 +309,7 @@ def test_block_bool(pub, blocks_feature):
|
|||
assert '<div class="value">No</div>' in resp
|
||||
|
||||
|
||||
def test_block_autocomplete_list(pub, blocks_feature):
|
||||
def test_block_autocomplete_list(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -346,7 +346,7 @@ def test_block_autocomplete_list(pub, blocks_feature):
|
|||
assert '>Bar<' in resp
|
||||
|
||||
|
||||
def test_block_geoloc_prefill(pub, blocks_feature):
|
||||
def test_block_geoloc_prefill(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -376,7 +376,7 @@ def test_block_geoloc_prefill(pub, blocks_feature):
|
|||
assert resp.html.find('div', {'data-geolocation': 'road'})
|
||||
|
||||
|
||||
def test_block_string_prefill(pub, blocks_feature):
|
||||
def test_block_string_prefill(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -476,7 +476,7 @@ def test_block_string_prefill(pub, blocks_feature):
|
|||
assert resp.form['f3$element0$f123'].value == 'Foobar'
|
||||
|
||||
|
||||
def test_block_prefill_and_required(pub, blocks_feature):
|
||||
def test_block_prefill_and_required(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -526,7 +526,7 @@ def test_block_prefill_and_required(pub, blocks_feature):
|
|||
assert formdata.data['3']['data'][0]['234'] is True
|
||||
|
||||
|
||||
def test_block_locked_prefill(pub, blocks_feature):
|
||||
def test_block_locked_prefill(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -714,7 +714,7 @@ def test_workflow_form_block_prefill(pub):
|
|||
assert resp.form['fxxx_3$element0$f123'].value == 'foo@localhost'
|
||||
|
||||
|
||||
def test_block_title_and_comment(pub, blocks_feature):
|
||||
def test_block_title_and_comment(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -743,7 +743,7 @@ def test_block_title_and_comment(pub, blocks_feature):
|
|||
resp = resp.follow()
|
||||
|
||||
|
||||
def test_block_label(pub, blocks_feature):
|
||||
def test_block_label(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -787,7 +787,7 @@ def test_block_label(pub, blocks_feature):
|
|||
assert 'Block Label' not in resp.text
|
||||
|
||||
|
||||
def test_block_multipage(pub, blocks_feature):
|
||||
def test_block_multipage(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -828,7 +828,7 @@ def test_block_multipage(pub, blocks_feature):
|
|||
assert '>bar<' in resp
|
||||
|
||||
|
||||
def test_block_repeated(pub, blocks_feature):
|
||||
def test_block_repeated(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -895,7 +895,7 @@ def test_block_repeated(pub, blocks_feature):
|
|||
assert '>bar2<' in resp
|
||||
|
||||
|
||||
def test_block_repeated_over_limit(pub, blocks_feature):
|
||||
def test_block_repeated_over_limit(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -943,7 +943,7 @@ def test_block_repeated_over_limit(pub, blocks_feature):
|
|||
assert 'Too many elements (maximum: 2)' in resp
|
||||
|
||||
|
||||
def test_block_repeated_files(pub, blocks_feature):
|
||||
def test_block_repeated_files(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ def test_block_repeated_files(pub, blocks_feature):
|
|||
|
||||
|
||||
@pytest.mark.parametrize('removed_line', [0, 1, 2])
|
||||
def test_block_repeated_remove_line(pub, blocks_feature, removed_line):
|
||||
def test_block_repeated_remove_line(pub, removed_line):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -1079,7 +1079,7 @@ def test_block_repeated_remove_line(pub, blocks_feature, removed_line):
|
|||
|
||||
|
||||
@pytest.mark.parametrize('block_name', ['foobar', 'Foo bar'])
|
||||
def test_block_digest(pub, blocks_feature, block_name):
|
||||
def test_block_digest(pub, block_name):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ def test_block_digest(pub, blocks_feature, block_name):
|
|||
assert formdef.data_class().select()[0].data['1_display'] == 'XfooY, Xfoo2Y'
|
||||
|
||||
|
||||
def test_block_digest_item(pub, blocks_feature):
|
||||
def test_block_digest_item(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
NamedDataSource.wipe()
|
||||
|
@ -1210,7 +1210,7 @@ def test_block_digest_item(pub, blocks_feature):
|
|||
assert formdef.data_class().select()[0].data['1_display'] == 'XunY, XdeuxY'
|
||||
|
||||
|
||||
def test_block_post_condition_on_2nd_page(pub, blocks_feature):
|
||||
def test_block_post_condition_on_2nd_page(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ def test_block_post_condition_on_2nd_page(pub, blocks_feature):
|
|||
|
||||
|
||||
@mock.patch('wcs.qommon.misc.urlopen')
|
||||
def test_block_with_dynamic_item_field(mock_urlopen, pub, blocks_feature):
|
||||
def test_block_with_dynamic_item_field(mock_urlopen, pub):
|
||||
def data_source(url):
|
||||
url, query = url.split('?q=')
|
||||
payload = []
|
||||
|
@ -1333,7 +1333,7 @@ def test_block_with_dynamic_item_field(mock_urlopen, pub, blocks_feature):
|
|||
assert resp.form['f2'].value == '1'
|
||||
|
||||
|
||||
def test_block_used_in_later_prefill(pub, blocks_feature):
|
||||
def test_block_used_in_later_prefill(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -1375,7 +1375,7 @@ def test_block_used_in_later_prefill(pub, blocks_feature):
|
|||
assert resp.form['f3'].value == '9'
|
||||
|
||||
|
||||
def test_block_add_and_locked_field(pub, blocks_feature):
|
||||
def test_block_add_and_locked_field(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ def test_block_add_and_locked_field(pub, blocks_feature):
|
|||
resp = resp.form.submit('submit') # -> submit
|
||||
|
||||
|
||||
def test_block_subfields_display_locations(pub, blocks_feature):
|
||||
def test_block_subfields_display_locations(pub):
|
||||
FormDef.wipe()
|
||||
BlockDef.wipe()
|
||||
|
||||
|
|
|
@ -3016,7 +3016,7 @@ def test_form_parent(pub):
|
|||
assert variables['form'].parent is not None
|
||||
|
||||
|
||||
def test_block_variables(pub, blocks_feature):
|
||||
def test_block_variables(pub):
|
||||
BlockDef.wipe()
|
||||
FormDef.wipe()
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ def test_form_snapshot_restore_with_import_error(pub):
|
|||
assert 'Can not restore snapshot (Unknown datasources [unknown])' in resp
|
||||
|
||||
|
||||
def test_block_snapshot_browse(pub, blocks_feature):
|
||||
def test_block_snapshot_browse(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
|
||||
|
|
|
@ -5218,7 +5218,7 @@ def test_set_backoffice_field_str_time_filter(two_pubs):
|
|||
formdata.store()
|
||||
|
||||
|
||||
def test_set_backoffice_field_block(two_pubs, blocks_feature):
|
||||
def test_set_backoffice_field_block(two_pubs):
|
||||
BlockDef.wipe()
|
||||
Workflow.wipe()
|
||||
FormDef.wipe()
|
||||
|
|
|
@ -1799,8 +1799,7 @@ class FormsDirectory(AccessControlled, Directory):
|
|||
r += htmltext('<span class="actions">')
|
||||
if is_global_accessible('forms'):
|
||||
r += htmltext('<a href="data-sources/">%s</a>') % _('Data sources')
|
||||
if get_publisher().has_site_option('fields-blocks'):
|
||||
r += htmltext('<a href="blocks/">%s</a>') % _('Fields blocks')
|
||||
r += htmltext('<a href="blocks/">%s</a>') % _('Fields blocks')
|
||||
if get_publisher().get_backoffice_root().is_accessible('categories'):
|
||||
r += htmltext('<a href="categories/">%s</a>') % _('Categories')
|
||||
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import')
|
||||
|
|
|
@ -988,8 +988,7 @@ class SettingsDirectory(QommonSettingsDirectory):
|
|||
if StudioDirectory.is_visible():
|
||||
form.add(CheckboxWidget, 'carddefs', title=_('Card Models'), value=True)
|
||||
form.add(CheckboxWidget, 'workflows', title=_('Workflows'), value=True)
|
||||
if get_publisher().has_site_option('fields-blocks'):
|
||||
form.add(CheckboxWidget, 'blockdefs', title=_('Fields Blocks'), value=True)
|
||||
form.add(CheckboxWidget, 'blockdefs', title=_('Fields Blocks'), value=True)
|
||||
if not get_cfg('sp', {}).get('idp-manage-roles'):
|
||||
form.add(CheckboxWidget, 'roles', title=_('Roles'), value=True)
|
||||
form.add(CheckboxWidget, 'categories', title=_('Categories'), value=True)
|
||||
|
|
|
@ -254,8 +254,7 @@ class CardsDirectory(FormsDirectory):
|
|||
r += htmltext('<span class="actions">')
|
||||
if get_publisher().get_backoffice_root().is_global_accessible('forms'):
|
||||
r += htmltext('<a href="../forms/data-sources/">%s</a>') % _('Data sources')
|
||||
if get_publisher().has_site_option('fields-blocks'):
|
||||
r += htmltext('<a href="../forms/blocks/">%s</a>') % _('Fields blocks')
|
||||
r += htmltext('<a href="../forms/blocks/">%s</a>') % _('Fields blocks')
|
||||
if get_publisher().get_backoffice_root().is_global_accessible('cards'):
|
||||
r += htmltext('<a href="categories/">%s</a>') % _('Categories')
|
||||
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import')
|
||||
|
|
|
@ -3518,9 +3518,7 @@ def get_field_options(blacklisted_types):
|
|||
# add computed field in its own "section"
|
||||
options.extend([('', '—', ''), (ComputedField.key, ComputedField.description, ComputedField.key)])
|
||||
|
||||
if get_publisher().has_site_option('fields-blocks') and (
|
||||
not blacklisted_types or 'blocks' not in blacklisted_types
|
||||
):
|
||||
if not blacklisted_types or 'blocks' not in blacklisted_types:
|
||||
position = len(options)
|
||||
for blockdef in BlockDef.select(order_by='name'):
|
||||
options.append(('block:%s' % blockdef.slug, blockdef.name, 'block:%s' % blockdef.slug))
|
||||
|
|
|
@ -384,7 +384,6 @@ class QommonPublisher(Publisher):
|
|||
'studio': True,
|
||||
'mail-templates': True,
|
||||
'external-workflow': True,
|
||||
'fields-blocks': True,
|
||||
'complex-data': True,
|
||||
}
|
||||
if self.site_options is None:
|
||||
|
|
Loading…
Reference in New Issue