Handle short name update in search folders
authorThierry Florac <tflorac@ulthar.net>
Wed, 03 Feb 2021 08:34:45 +0100
changeset 1456 a07b27effd38
parent 1455 d3a1d91dd65b
child 1457 c57aa476bc69
Handle short name update in search folders
src/pyams_content/features/search/__init__.py
src/pyams_content/shared/common/__init__.py
src/pyams_content/shared/common/zmi/properties.py
--- a/src/pyams_content/features/search/__init__.py	Mon Feb 01 13:47:19 2021 +0100
+++ b/src/pyams_content/features/search/__init__.py	Wed Feb 03 08:34:45 2021 +0100
@@ -44,6 +44,7 @@
 
     content_name = _("Search folder")
 
+    handle_short_name = True
     handle_header = True
     handle_description = True
 
--- a/src/pyams_content/shared/common/__init__.py	Mon Feb 01 13:47:19 2021 +0100
+++ b/src/pyams_content/shared/common/__init__.py	Wed Feb 03 08:34:45 2021 +0100
@@ -156,6 +156,7 @@
     content_type = None
     content_name = None
 
+    handle_short_name = False
     handle_content_url = True
     handle_header = True
     handle_description = True
--- a/src/pyams_content/shared/common/zmi/properties.py	Mon Feb 01 13:47:19 2021 +0100
+++ b/src/pyams_content/shared/common/zmi/properties.py	Wed Feb 03 08:34:45 2021 +0100
@@ -120,7 +120,8 @@
 def handle_content_properties_data_extraction(event):
     """Automatically set short_name as title"""
     data = event.data
-    data['short_name'] = data['title'].copy()
+    if not event.form.context.handle_short_name:
+        data['short_name'] = data['title'].copy()
     if 'content_url' in data:
         data['content_url'] = generate_url(data['content_url'])