Commits

Zhang Huangbin committed af58d78

Fixed:
+ Incorrect URL handlers in controllers/dbmail_mysql/{alias,user}.py.
+ Incorrect count of alias accounts.
Thanks Harley Laue <hlaue _at_ ics-llc.net> for the report and patch.

  • Participants
  • Parent commits c0baf5b

Comments (0)

Files changed (4)

ChangeLog.dbmail_mysql

         + Able to execute addition SQL commands after creating user.
 
     * Fixed:
+        + Incorrect URL handlers in controllers/dbmail_mysql/{alias,user}.py.
+        + Incorrect count of alias accounts.
+        + Incorrect indent in libs/md5crypt.py.
         + Incorrect SQL table name used for deleting admin accounts.
         + Missing some msg handlers in account list pages.
           Thanks Jure Pečar <jure.pecar _at_ arctur.si> for the report.

controllers/dbmail_mysql/alias.py

         if qr[0] is True:
             allDomains = qr[1]
         else:
-            raise web.seeother('/domains?msg=' % web.urlquote(qr[1]))
+            raise web.seeother('/domains?msg=' + web.urlquote(qr[1]))
 
         # Set first domain as current domain.
         if self.cur_domain is None:

controllers/dbmail_mysql/user.py

         if qr[0] is True:
             allDomains = qr[1]
         else:
-            raise web.seeother('/domains?msg=' % web.urlquote(qr[1]))
+            raise web.seeother('/domains?msg=' + web.urlquote(qr[1]))
 
         # Set first domain as current domain.
         if self.cur_domain is None:

libs/dbmail_mysql/alias.py

         sql_vars = {'domain': self.domain, }
 
         try:
+            resultOfTotal = self.conn.select(
+                'dbmail_aliases_extra',
+                vars=sql_vars,
+                what='COUNT(id) AS total',
+                where='domain=$domain',
+            )
+            if len(resultOfTotal) == 1:
+                total = resultOfTotal[0].total or 0
+
             resultOfRecords = self.conn.select(
                 'dbmail_aliases_extra',
                 vars=sql_vars,
                 offset=(cur_page - 1) * settings.PAGE_SIZE_LIMIT,
             )
             records = list(resultOfRecords)
-            return (True, len(records), records)
+            return (True, total, records)
         except Exception, e:
             return (False, str(e))