Change values separator to be able to handle LDAP DNs containing commas
authorThierry Florac <tflorac@ulthar.net>
Sat, 28 Feb 2015 15:25:05 +0100
changeset 7 7920b5e679ec
parent 6 1a562df03e2d
child 8 67acb59f115e
Change values separator to be able to handle LDAP DNs containing commas
src/pyams_security/widget/__init__.py
src/pyams_security/widget/templates/principals-set-display.pt
src/pyams_security/widget/templates/principals-set-input.pt
--- a/src/pyams_security/widget/__init__.py	Sat Feb 28 15:23:57 2015 +0100
+++ b/src/pyams_security/widget/__init__.py	Sat Feb 28 15:25:05 2015 +0100
@@ -92,7 +92,7 @@
         # Principals set widget only returns selected principal IDs in a single input
         if not value:
             return set()
-        return set(value.split(','))
+        return set(value.split('|'))
 
 
 @widgettemplate_config(mode='input', template='templates/principals-set-input.pt', layer=IFormLayer)
--- a/src/pyams_security/widget/templates/principals-set-display.pt	Sat Feb 28 15:23:57 2015 +0100
+++ b/src/pyams_security/widget/templates/principals-set-display.pt	Sat Feb 28 15:25:05 2015 +0100
@@ -1,11 +1,12 @@
 <input type="hidden" autocomplete="off" readonly
 	data-ams-select2-multiple="true"
+	data-ams-select2-separator="|"
 	tal:attributes="id view/id;
 					name view/name;
 					class string:select2 ${view/klass};
 					style view/style;
 					title view/title;
-					value python:','.join((value.id for value in view.value));
+					value python:'|'.join((value.id for value in view.value));
 					lang view/lang;
 					onclick view/onclick;
 					ondblclick view/ondblclick;
--- a/src/pyams_security/widget/templates/principals-set-input.pt	Sat Feb 28 15:23:57 2015 +0100
+++ b/src/pyams_security/widget/templates/principals-set-input.pt	Sat Feb 28 15:25:05 2015 +0100
@@ -11,13 +11,14 @@
 			data-ams-select2-minimum-input-length="2"
 			data-ams-select2-allow-clear="true"
 			data-ams-select2-multiple="true"
+			data-ams-select2-separator="|"
 			data-ams-select2-query-url="find-principals.json"
 			tal:attributes="id view/id;
 							name view/name;
 							class string:select2 ${view/klass};
 							style view/style;
 							title view/title;
-							value python:','.join((value.id for value in view.value));
+							value python:'|'.join((value.id for value in view.value));
 							lang view/lang;
 							onclick view/onclick;
 							ondblclick view/ondblclick;