diff --git a/ldapcherry/attributes.py b/ldapcherry/attributes.py index 15da584..5ba525f 100644 --- a/ldapcherry/attributes.py +++ b/ldapcherry/attributes.py @@ -16,7 +16,7 @@ from sets import Set import yaml # List of available types for form -types = ['string', 'email', 'int', 'stringlist', 'fix', 'password'] +types = ['string', 'textfield', 'email', 'int', 'stringlist', 'fix', 'password'] class Attributes: @@ -81,6 +81,8 @@ class Attributes: attr_type = self.attributes[attrid]['type'] if attr_type == 'string': return + elif attr_type == 'textfield': + return elif attr_type == 'email': if self._is_email(value): return diff --git a/resources/templates/form.tmpl b/resources/templates/form.tmpl index 0ef36af..7ce5cce 100644 --- a/resources/templates/form.tmpl +++ b/resources/templates/form.tmpl @@ -26,14 +26,15 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']): required = ' required ' if not values is None and a in values: if type(values[a]) is list: - tmp = values[a][0] + raw_value = values[a][0] else: - tmp = values[a] - if tmp is None: - tmp = '' - value = ' value="'+ tmp + '"' - value2 = '' + raw_value = values[a] + if raw_value is None: + raw_value = '' + value = ' value="'+ raw_value + '"' + value2 = '' else: + raw_value = '' value = '' value2 = '' if 'default' in attr and value == '': @@ -43,7 +44,7 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']): ${attr['display_name']} % if modify and a == keyattr: - ${tmp} + ${raw_value} % elif attr['type'] == 'string': % elif attr['type'] == 'email': @@ -64,6 +65,8 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']): Retype ${attr['display_name']} + % elif attr['type'] == 'textfield': + % endif