changeset e7540163fd94 in proteus:default
details: https://hg.tryton.org/proteus?cmd=changeset;node=e7540163fd94
description:
        Support database without schema with TRYTOND_DATABASE_URI

        If the command line is launch with only the database name, we must 
consider the
        TRYTOND_DATABASE_URI to configure the backend. This way, we unify the 
module
        scripts options with the trytond scripts.

        issue9365
        review297831002
diffstat:

 proteus/config.py |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 502ea1e276ec -r e7540163fd94 proteus/config.py
--- a/proteus/config.py Mon May 04 12:02:22 2020 +0200
+++ b/proteus/config.py Sat Jun 06 14:06:58 2020 +0200
@@ -222,6 +222,11 @@
         super(TrytondConfig, self).__init__()
         if not database:
             database = os.environ.get('TRYTOND_DATABASE_URI')
+        elif (os.environ.get('TRYTOND_DATABASE_URI')
+                and not urllib.parse.urlparse(database).scheme):
+            url = urllib.parse.urlparse(os.environ['TRYTOND_DATABASE_URI'])
+            os.environ['TRYTOND_DATABASE_URI'] = urllib.parse.urlunparse(
+                url._replace(path=database))
         else:
             os.environ['TRYTOND_DATABASE_URI'] = database
         if not config_file:

Reply via email to