skytools.DBObject: remove duplicated file find logic
authorMarko Kreen <markokr@gmail.com>
Tue, 1 Jun 2010 13:55:29 +0000 (16:55 +0300)
committerMarko Kreen <markokr@gmail.com>
Wed, 9 Jun 2010 14:51:01 +0000 (17:51 +0300)
python/skytools/sqltools.py

index 76d73efad9f39c5fc71f1e887e9bd94238461fc3..197bbe15a3e3dc39b7753b4353dad6bb873439be 100644 (file)
@@ -437,20 +437,7 @@ class DBObject(object):
 
     def find_file(self):
         """Find install script file."""
-        full_fn = None
-        if self.sql_file[0] == "/":
-            full_fn = self.sql_file
-        else:
-            dir_list = skytools.installer_config.sql_locations
-            for fdir in dir_list:
-                fn = os.path.join(fdir, self.sql_file)
-                if os.path.isfile(fn):
-                    full_fn = fn
-                    break
-
-        if not full_fn:
-            raise Exception('File not found: '+self.sql_file)
-        return full_fn
+        return installer_find_file(self.sql_file)
 
 class DBSchema(DBObject):
     """Handles db schema."""