mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24: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,33 +86,31 @@ ${form_col(lc2)}
|
|||||||
</div>
|
</div>
|
||||||
% if autofill:
|
% if autofill:
|
||||||
<%
|
<%
|
||||||
import sys
|
attr_set = []
|
||||||
if sys.version < '3':
|
|
||||||
from sets import Set as set
|
|
||||||
|
|
||||||
attr_set = set([])
|
|
||||||
attr_events = {}
|
attr_events = {}
|
||||||
functions = {}
|
functions = {}
|
||||||
for attrid in attributes:
|
for attrid in attributes:
|
||||||
attr = attributes[attrid]
|
attr = attributes[attrid]
|
||||||
field = 'attr.' + attrid
|
field = 'attr.' + attrid
|
||||||
attr_set.add(field)
|
if field not in attr_set:
|
||||||
if 'autofill' in attr:
|
attr_set.append(field)
|
||||||
function = attr['autofill']['function']
|
if 'autofill' in attr:
|
||||||
tuple = (field, function)
|
function = attr['autofill']['function']
|
||||||
if not tuple in functions:
|
tuple = (field, function)
|
||||||
functions[tuple] = []
|
if not tuple in functions:
|
||||||
for arg in attr['autofill']['args']:
|
functions[tuple] = []
|
||||||
if arg[0] == '$':
|
for arg in attr['autofill']['args']:
|
||||||
field_arg = 'attr.' + arg[1:]
|
if arg[0] == '$':
|
||||||
attr_set.add(field_arg)
|
field_arg = 'attr.' + arg[1:]
|
||||||
functions[tuple].append("fields['" + field_arg + "'].value")
|
if field_arg not in attr_set:
|
||||||
if not field_arg in attr_events:
|
attr_set.append(field_arg)
|
||||||
attr_events[field_arg] = []
|
functions[tuple].append("fields['" + field_arg + "'].value")
|
||||||
attr_events[field_arg].append(tuple)
|
if not field_arg in attr_events:
|
||||||
else:
|
attr_events[field_arg] = []
|
||||||
value = arg
|
attr_events[field_arg].append(tuple)
|
||||||
functions[tuple].append("'" + value + "'")
|
else:
|
||||||
|
value = arg
|
||||||
|
functions[tuple].append("'" + value + "'")
|
||||||
%>
|
%>
|
||||||
<script>
|
<script>
|
||||||
var fields = new Object();
|
var fields = new Object();
|
||||||
|
Loading…
Reference in New Issue
Block a user