主题: iredadmin编辑用户帐号信息时的错误

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):
- 使用的 Linux/BSD 发行版名称及版本号:
- 与您的问题相关的日志信息:
====
- iRedMail 版本号:0.9.5-1
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):OpenLDAP
- 使用的 Linux/BSD 发行版名称及版本号:Ubuntu 16.04 LTS

进入iredadmin,修改一个用户帐户的信息,比如修改空间配额,保存时,页面上出现internal server error
查apache的error.log,显示如下:
[Mon Oct 17 09:05:28.920156 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737] Traceback (most recent call last):
[Mon Oct 17 09:05:28.920190 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 239, in process
[Mon Oct 17 09:05:28.920195 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return self.handle()
[Mon Oct 17 09:05:28.920198 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 230, in handle
[Mon Oct 17 09:05:28.920202 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return self._delegate(fn, self.fvars, args)
[Mon Oct 17 09:05:28.920205 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 420, in _delegate
[Mon Oct 17 09:05:28.920208 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return handle_class(cls)
[Mon Oct 17 09:05:28.920211 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 396, in handle_class
[Mon Oct 17 09:05:28.920214 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return tocall(*args)
[Mon Oct 17 09:05:28.920216 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/opt/www/iredadmin/controllers/decorators.py", line 36, in decorated
[Mon Oct 17 09:05:28.920219 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return f(*args, **kw)
[Mon Oct 17 09:05:28.920222 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/opt/www/iredadmin/controllers/decorators.py", line 11, in proxyfunc
[Mon Oct 17 09:05:28.920225 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return func(self, *args, **kw)
[Mon Oct 17 09:05:28.920228 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/opt/www/iredadmin/controllers/ldap/user.py", line 164, in POST
[Mon Oct 17 09:05:28.920231 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     data=i,
[Mon Oct 17 09:05:28.920234 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/opt/www/iredadmin/libs/ldaplib/decorators.py", line 43, in proxyfunc
[Mon Oct 17 09:05:28.920236 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     return func(*args, **kw)
[Mon Oct 17 09:05:28.920239 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/opt/www/iredadmin/libs/ldaplib/user.py", line 517, in update
[Mon Oct 17 09:05:28.920242 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     action='delete',
[Mon Oct 17 09:05:28.920245 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]   File "/opt/www/iredadmin/libs/ldaplib/connUtils.py", line 53, in addOrDelAttrValue
[Mon Oct 17 09:05:28.920248 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737]     if settings.LDAP_SERVER_TYPE == 'LDAPD':
[Mon Oct 17 09:05:28.920251 2016] [wsgi:error] [pid 3795] [remote 118.193.143.31:62737] AttributeError: 'module' object has no attribute 'LDAP_SERVER_TYPE'

回复: iredadmin编辑用户帐号信息时的错误

Bug. 请用此补丁修复。

diff -r b58e995057cb libs/ldaplib/connUtils.py
--- a/libs/ldaplib/connUtils.py    Fri Oct 14 09:47:43 2016 +0800
+++ b/libs/ldaplib/connUtils.py    Mon Oct 17 09:32:32 2016 +0800
@@ -50,7 +50,7 @@
             # As a workaround, we perform one extra LDAP query to get all
             # present values of the attribute first, then remove the one we
             # want to delete.
-            if settings.LDAP_SERVER_TYPE == 'LDAPD':
+            if settings.LDAP_SERVER_PRODUCT_NAME == 'LDAPD':
                 try:
                     # Get present values
                     qr = self.conn.search_s(dn, ldap.SCOPE_BASE, attrlist=[attr])

回复: iredadmin编辑用户帐号信息时的错误

嗯,改好了,谢谢!