mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +01:00
fix unicode
This commit is contained in:
parent
b5a8e302d1
commit
147cad3511
@ -372,6 +372,11 @@ class LdapCherry(object):
|
||||
attrid = self.attributes.backend_attributes[b][attr]
|
||||
if not attr in ret:
|
||||
ret[attrid] = tmp[attr]
|
||||
|
||||
cherrypy.log.error(
|
||||
msg = "user '" + username + "' attributes " + str(ret),
|
||||
severity = logging.DEBUG
|
||||
)
|
||||
return ret
|
||||
|
||||
def _parse_params(self, params):
|
||||
|
@ -163,10 +163,10 @@ class Backend(ldapcherry.backend.Backend):
|
||||
return dn_entry
|
||||
|
||||
def _str(self, s):
|
||||
try:
|
||||
return str(s)
|
||||
except UnicodeEncodeError:
|
||||
return unicode(s).encode('unicode_escape')
|
||||
return s.encode('utf-8')
|
||||
|
||||
def _uni(self, s):
|
||||
return s.decode('utf-8')
|
||||
|
||||
def auth(self, username, password):
|
||||
|
||||
@ -303,9 +303,9 @@ class Backend(ldapcherry.backend.Backend):
|
||||
for attr in attrs_tmp:
|
||||
value_tmp = attrs_tmp[attr]
|
||||
if len(value_tmp) == 1:
|
||||
attrs[attr] = value_tmp[0]
|
||||
attrs[attr] = self._uni(value_tmp[0])
|
||||
else:
|
||||
attrs[attr] = value_tmp
|
||||
attrs[attr] = map(self._uni, value_tmp)
|
||||
|
||||
if self.key in attrs:
|
||||
ret[attrs[self.key]] = attrs
|
||||
@ -317,9 +317,9 @@ class Backend(ldapcherry.backend.Backend):
|
||||
for attr in attrs_tmp:
|
||||
value_tmp = attrs_tmp[attr]
|
||||
if len(value_tmp) == 1:
|
||||
ret[attr] = value_tmp[0]
|
||||
ret[attr] = self._uni(value_tmp[0])
|
||||
else:
|
||||
ret[attr] = value_tmp
|
||||
ret[attr] = map(self._uni, value_tmp)
|
||||
return ret
|
||||
|
||||
def get_groups(self, username):
|
||||
@ -333,5 +333,5 @@ class Backend(ldapcherry.backend.Backend):
|
||||
groups = self._search(searchfilter, NO_ATTR, self.groupdn)
|
||||
ret = []
|
||||
for entry in groups:
|
||||
ret.append(entry[0])
|
||||
ret.append(self._uni(entry[0]))
|
||||
return ret
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix top-buffer bottom-buffer">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%
|
||||
len_attr = len(attributes)
|
||||
switch = len_attr / 2
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
</%block>
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="base.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix" style="margin-top:30px">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix top-buffer bottom-buffer">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
#<%inherit file="base.tmpl"/>
|
||||
<%block name="navbar">
|
||||
<div class="row clearfix">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<script type="text/javascript">
|
||||
var graph = ${graph_js};
|
||||
var roles = ${roles_js};
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix">
|
||||
|
@ -1,3 +1,4 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="navbar.tmpl"/>
|
||||
<%block name="core">
|
||||
<div class="row clearfix top-buffer bottom-buffer">
|
||||
|
Loading…
Reference in New Issue
Block a user