[GRASS-SVN] r54876 - grass/trunk/scripts/v.db.reconnect.all

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 3 10:25:57 PST 2013


Author: mmetz
Date: 2013-02-03 10:25:56 -0800 (Sun, 03 Feb 2013)
New Revision: 54876

Modified:
   grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py
Log:
v.db.reconnect.all: db.create does not substitute variables

Modified: grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py
===================================================================
--- grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py	2013-02-03 18:01:20 UTC (rev 54875)
+++ grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py	2013-02-03 18:25:56 UTC (rev 54876)
@@ -66,8 +66,9 @@
 
 # create database if doesn't exist
 def create_db(driver, database):
+    subst_database = substitute_db(database)
     if driver == 'dbf':
-        path = substitute_db(database)
+        path = subst_database
         # check if destination directory exists
         if not os.path.isdir(path):
 	    # create dbf database
@@ -76,21 +77,21 @@
         return False
     
     if driver == 'sqlite':
-        path = os.path.dirname(substitute_db(database))
+        path = os.path.dirname(subst_database)
         # check if destination directory exists
         if not os.path.isdir(path):
             os.makedirs(path)
     
-    if substitute_db(database) in grass.read_command('db.databases', quiet = True,
+    if subst_database in grass.read_command('db.databases', quiet = True,
                                       driver = driver).splitlines():
         return False
 
     grass.info(_("Target database doesn't exist, "
                  "creating a new database using <%s> driver...") % driver)
     if 0 != grass.run_command('db.createdb', driver = driver,
-                              database = database):
+                              database = subst_database):
         grass.fatal(_("Unable to create database <%s> by driver <%s>") % \
-                        (database, driver))
+                        (subst_database, driver))
         
     return False
 



More information about the grass-commit mailing list