Univention Bugzilla – Bug 46575
pykota postgresql handling broken
Last modified: 2018-04-14 13:34:15 CEST
ERROR: PyKota v1.26_fixes_official ERROR: pkusers failed ERROR: Traceback (most recent call last): ERROR: File "/usr/bin/pkusers", line 406, in <module> ERROR: manager.deferredInit() ERROR: File "/usr/lib/pymodules/python2.7/pykota/tool.py", line 457, in deferredInit ERROR: self.storage = storage.openConnection(self) ERROR: File "/usr/lib/pymodules/python2.7/pykota/storage.py", line 866, in openConnection ERROR: return storagebackend.Storage(pykotatool, host, database, admin, adminpw) ERROR: File "/usr/lib/pymodules/python2.7/pykota/storages/pgstorage.py", line 65, in __init__ ERROR: self.quote = pg._quote ERROR: AttributeError: 'module' object has no attribute '_quote' seems that pykota is too old for the new python-pygresql
update the pykota package, * some necessary changes for debian package * update of the pykota-postgresql.sql file (see Bug #46570) * fix for storages/pgstorage.py i replaced quota with database.adapter.adapt_inline, which seem to be the new way to do it (?) +++ pykota-1.27.0/pykota/storages/pgstorage.py 2018-03-09 15:48:33.000000000 +0100 @@ -60,10 +60,6 @@ raise PGError, msg self.closed = 0 try : - self.quote = self.database._quote - except AttributeError : # pg <v4.x - self.quote = pg._quote - try : self.database.query("SET CLIENT_ENCODING TO 'UTF-8';") except PGError, msg : self.tool.logdebug("Impossible to set database client encoding to UTF-8 : %s" % msg) @@ -137,15 +133,7 @@ def doQuote(self, field) : """Quotes a field for use as a string in SQL queries.""" - if type(field) == type(0.0) : - typ = "decimal" - elif type(field) == type(0) : - typ = "int" - elif type(field) == type(0L) : - typ = "int" - else : - typ = "text" - return self.quote(field, typ) + return self.database.adapter.adapt_inline(field)
Created attachment 9460 [details] python-pygresql-stuff.patch
Created attachment 9461 [details] debian-stuff.patch
Tests: OK, I've installed a UCS 4.3 and tested the printquota settings for one user. Changelog: OK
UCS 4.3 has been released: https://docs.software-univention.de/release-notes-4.3-0-en.html https://docs.software-univention.de/release-notes-4.3-0-de.html If this error occurs again, please use "Clone This Bug".