[server] explicitly set postgres LC_MESSAGES variable to C on connection
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 05 Feb 2016 14:48:23 +0100
changeset 11248 b288debc6736
parent 11247 518eb10adcd5
child 11249 0ff4c02a1871
[server] explicitly set postgres LC_MESSAGES variable to C on connection We parse some error messages so we need them to be in English. It's not clear to me exactly when that's not the case, but this fixes running unittest_postgres' "test_constraint_validationerror" with py.test for Sylvain.
cubicweb/server/sqlutils.py
--- a/cubicweb/server/sqlutils.py	Thu Mar 19 21:19:52 2015 +0100
+++ b/cubicweb/server/sqlutils.py	Fri Feb 05 14:48:23 2016 +0100
@@ -584,6 +584,7 @@
 def _init_postgres_connection(cnx):
     """Internal function that will be called to init a postgresql connection"""
     cnx.cursor().execute('SET TIME ZONE UTC')
+    cnx.cursor().execute("SET lc_messages to 'C'")
     # commit is needed, else setting are lost if the connection is first
     # rolled back
     cnx.commit()