mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +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:
parent
2df56d2de2
commit
921a0820f4
@ -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] = []
|
||||
|
Loading…
Reference in New Issue
Block a user