mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-21 17:04:21 +01:00
fix template over-escaping + python 3 support
The templates were html escaping the generated js code for the autofill and the role management. This was breaking these features. It's okay to not escape these as they are coming from a trusted source (configuration file). Also make the templates python3 compatible (not need to import Set in python 3)
This commit is contained in:
parent
5b0c72a572
commit
2df56d2de2
@ -58,7 +58,7 @@
|
||||
<body>
|
||||
% if notifications:
|
||||
% for notif in notifications:
|
||||
<script type="text/javascript">$.notify('${notif}')</script>
|
||||
<script type="text/javascript">$.notify('${notif | n}')</script>
|
||||
% endfor
|
||||
% endif
|
||||
<div class="container">
|
||||
|
@ -86,8 +86,11 @@ ${form_col(lc2)}
|
||||
</div>
|
||||
% if autofill:
|
||||
<%
|
||||
from sets import Set
|
||||
attr_set = Set([])
|
||||
import sys
|
||||
if sys.version < '3':
|
||||
from sets import Set as set
|
||||
|
||||
attr_set = set([])
|
||||
attr_events = {}
|
||||
functions = {}
|
||||
for attrid in attributes:
|
||||
@ -122,7 +125,7 @@ if (fields['${attrid}'] != null) {
|
||||
fields['${attrid}'].onchange = function () {
|
||||
% for tuple in attr_events[attrid]:
|
||||
if (typeof(${tuple[1]}) == "function") {
|
||||
fields['${tuple[0]}'].value = ${tuple[1]}(${', '.join(functions[tuple])});
|
||||
fields['${tuple[0]}'].value = ${tuple[1] | n}(${', '.join(functions[tuple]) | n});
|
||||
}
|
||||
% endfor
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<script type="text/javascript">
|
||||
var graph = ${graph_js};
|
||||
var roles = ${roles_js};
|
||||
var graph = ${graph_js | n};
|
||||
var roles = ${roles_js | n};
|
||||
function enableParentRoles(roleid){
|
||||
var parentRoles = graph[roleid]['parent_roles'];
|
||||
var DnRole = roles[roleid];
|
||||
|
Loading…
Reference in New Issue
Block a user