--- a/src/pyams_content/shared/form/zmi/field.py Mon Jul 02 22:59:44 2018 +0200
+++ b/src/pyams_content/shared/form/zmi/field.py Mon Jul 02 23:00:09 2018 +0200
@@ -46,6 +46,7 @@
from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
from pyams_utils.fanstatic import get_resource_path
from pyams_utils.traversing import get_parent
+from pyams_utils.unicode import translate_string
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
@@ -261,9 +262,10 @@
def handle_new_form_field_data_extraction(event):
"""Handle new form field form data extraction"""
container = IFormFieldContainer(event.form.context)
- name = event.data.get('name')
+ name = translate_string(event.data.get('name'), spaces='_', keep_chars='_')
if name in container:
event.form.widgets.errors += (Invalid(_("Specified name is already used!")),)
+ event.data['name'] = name
@pagelet_config(name='properties.html', context=IFormField, layer=IPyAMSLayer, permission=MANAGE_CONTENT_PERMISSION)