1

Topic: Internal Server Error after Upgrade to 1.9.1 (MySQL)

==== Required information ====
- iRedMail version: 0.9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Debian Wheezy
- Related log if you're reporting an issue: apache log
====

After Upgrade to 1.9.1 we cannot access users Profile Page anymore, result is: internal server error
We get the following log in apache error log:

Traceback (most recent call last):
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 239, in process
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return self.handle()
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 230, in handle
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return self._delegate(fn, self.fvars, args)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 420, in _delegate
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return handle_class(cls)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 396, in handle_class
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return tocall(*args)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/controllers/decorators.py", line 22, in proxyfunc
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return func(self, *args, **kw)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/controllers/mysql/user.py", line 301, in GET
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     msg=i.get('msg'),
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/libs/iredbase.py", line 201, in render_template
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return jinja_env.get_template(template_name).render(context)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return self.environment.handle_exception(exc_info, True)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/libs/../templates/default/mysql/user/profile.html", line 49, in
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     {% from "macros/msgHandlers.html" import userMsgHandler with context %}
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/libs/../templates/default/layout.html", line 167, in top-level t
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     {% block main %}{% endblock %}
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/libs/../templates/default/mysql/user/profile.html", line 164, in
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     {{ display_all_domains(managedDomains=managed_domains,
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/share/apache2/iredadmin/libs/../templates/default/macros/sql.html", line 8, in template
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     {% for r in allDomains |sort %}
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]   File "/usr/lib/python2.7/dist-packages/jinja2/filters.py", line 233, in do_sort
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]     return sorted(value, key=sort_func, reverse=reverse)
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx] TypeError: can't compare datetime.datetime to NoneType 
[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx]

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Internal Server Error after Upgrade to 1.9.1 (MySQL)

srd2010 wrote:

[Mon Jan 19 17:24:25 2015] [error] [client xxx.xxx.xxx.xxx] TypeError: can't compare datetime.datetime to NoneType 

Cannot troubleshoot with this error message. Is it possible to let me login to your server for further debug?

3

Re: Internal Server Error after Upgrade to 1.9.1 (MySQL)

sure. just get i touch with me via email / PM

4

Re: Internal Server Error after Upgrade to 1.9.1 (MySQL)

Confirmed, bug in the latest iRedAdmin-Pro-MySQL-1.9.1 and iRedAdmin-Pro-PGSQL-1.5.1:

Patch for iRedAdmin-Pro-MySQL-1.9.1:

diff -r e15248ccfebb -r 247d2bd24370 controllers/mysql/user.py
--- a/controllers/mysql/user.py    Fri Jan 23 22:17:21 2015 +0800
+++ b/controllers/mysql/user.py    Mon Jan 26 23:11:24 2015 +0800
@@ -247,7 +247,7 @@
                 managed_domains += qr[1]
             del qr
 
-            qr = connutils.get_all_domains()
+            qr = connutils.get_all_domains(columns=['domain', 'description'])
             if qr[0]:
                 all_domains = qr[1]
 

And patch for iRedAdmin-Pro-PGSQL-1.5.1:

diff -r e15248ccfebb -r 247d2bd24370 controllers/pgsql/user.py
--- a/controllers/pgsql/user.py    Fri Jan 23 22:17:21 2015 +0800
+++ b/controllers/pgsql/user.py    Mon Jan 26 23:11:24 2015 +0800
@@ -229,7 +229,7 @@
                 managed_domains += qr[1]
             del qr
 
-            qr = connutils.get_all_domains()
+            qr = connutils.get_all_domains(columns=['domain', 'description'])
             if qr[0]:
                 all_domains = qr[1]