1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 02:34:31 +01:00

switch to using lists in templates

Sets are not available in mako templates when using python3.
Reverting to using lists with 'if not in' checks to avoid duplication.
This commit is contained in:
kakwa 2019-02-06 22:26:46 +01:00
parent 2df56d2de2
commit 921a0820f4

View File

@ -86,17 +86,14 @@ ${form_col(lc2)}
</div>
% if autofill:
<%
import sys
if sys.version < '3':
from sets import Set as set
attr_set = set([])
attr_set = []
attr_events = {}
functions = {}
for attrid in attributes:
attr = attributes[attrid]
field = 'attr.' + attrid
attr_set.add(field)
if field not in attr_set:
attr_set.append(field)
if 'autofill' in attr:
function = attr['autofill']['function']
tuple = (field, function)
@ -105,7 +102,8 @@ for attrid in attributes:
for arg in attr['autofill']['args']:
if arg[0] == '$':
field_arg = 'attr.' + arg[1:]
attr_set.add(field_arg)
if field_arg not in attr_set:
attr_set.append(field_arg)
functions[tuple].append("fields['" + field_arg + "'].value")
if not field_arg in attr_events:
attr_events[field_arg] = []