<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -37,58 +37,18 @@ class FileConfig(Config):
     
     class SettingsFile(object):
         @staticmethod
-        def get_file_imports(filename):
-            imports = []
-            try:
-                f = open(filename)
-                for line in f:
-                    line = line.rstrip()
-                    if line.startswith('import') or line.startswith('from'):
-                        imports.append(line)
-            finally:
-                f.close()
-            return imports
-        
-        @staticmethod
-        def exec_import(import_line, global_variables, local_variables):
-            if import_line.startswith('import'):
-                modules = import_line.lstrip('import').split(',')
-                for module in modules:
-                    __import__(module.strip(), global_variables, local_variables, [], -1)
-            else:
-                match = re.search(r'from (.*) import (.*)', import_line)
-                modules = [m.strip() for m in match.groups()[1].split(',')]
-                __import__(match.groups()[0], global_variables, local_variables, modules, -1)
-                
-        @staticmethod
         def import_file(full_filename):
             path, filename = os.path.split(full_filename)
             
-            # add settings dir from path
-            sys.path.insert(0, path)
-            
-            # read imports from config file
-#            try:
-#                modules = FileConfig.SettingsFile.get_file_imports(full_filename)
-#                for module in modules:
-#                    FileConfig.SettingsFile.exec_import(module, globals(), locals())
-#            except Exception, e:
-#                raise Exception(&quot;error executing imports from config file '%s': %s&quot; % (filename, str(e)))
-
             # read config file
-            local_variables = locals()
-            local_variables['__file__'] = full_filename
             try:
-                execfile(full_filename, globals(), local_variables)
+                execfile(full_filename)
             except IOError:
-                raise Exception(&quot;%s: file not found&quot; % filename)
+                raise Exception(&quot;%s: file not found&quot; % full_filename)
             except Exception, e:
                 raise Exception(&quot;error interpreting config file '%s': %s&quot; % (filename, str(e)))
-
-            # remove settings dir from path
-            sys.path.remove(path)
             
-            return local_variables
+            return locals()
     
     def __init__(self, config_file=&quot;simple-db-migrate.conf&quot;):
         self._config = {}
@@ -97,18 +57,18 @@ class FileConfig(Config):
         # read configuration
         settings = FileConfig.SettingsFile.import_file(config_file)
         
-        config_path = os.path.split(config_file)[0]
         self.put(&quot;db_host&quot;, self.get_variable(settings, 'DATABASE_HOST', 'HOST'))
         self.put(&quot;db_user&quot;, self.get_variable(settings, 'DATABASE_USER', 'USERNAME'))
         self.put(&quot;db_password&quot;, self.get_variable(settings, 'DATABASE_PASSWORD', 'PASSWORD'))
         self.put(&quot;db_name&quot;, self.get_variable(settings, 'DATABASE_NAME', 'DATABASE'))
         
         migrations_dir = self.get_variable(settings, 'DATABASE_MIGRATIONS_DIR', 'MIGRATIONS_DIR')
-        self.put(&quot;migrations_dir&quot;, self._parse_migrations_dir(migrations_dir, config_path))
+        config_dir = os.path.split(config_file)[0]
+        self.put(&quot;migrations_dir&quot;, self._parse_migrations_dir(migrations_dir, config_dir))
         
-    def get_variable(self, local_variables_dict, name, old_name):
-        if name in local_variables_dict or old_name in local_variables_dict:
-            return local_variables_dict.get(name, local_variables_dict.get(old_name))
+    def get_variable(self, settings, name, old_name):
+        if name in settings or old_name in settings:
+            return settings.get(name, settings.get(old_name))
         else:
             raise NameError(&quot;config file error: name '%s' is not defined&quot; % name)
 </diff>
      <filename>src/config.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>040e397f0eb0707d4ffbf023a9df3a22be62a168</id>
    </parent>
  </parents>
  <author>
    <name>Guilherme Chapiewski</name>
    <email>guilherme.chapiewski@gmail.com</email>
  </author>
  <url>http://github.com/guilhermechapiewski/simple-db-migrate/commit/e86b1bce7f8c217a4c66515b1e19b401e80fd884</url>
  <id>e86b1bce7f8c217a4c66515b1e19b401e80fd884</id>
  <committed-date>2009-10-06T11:58:56-07:00</committed-date>
  <authored-date>2009-10-06T11:58:56-07:00</authored-date>
  <message>#58: Back to reading file in a simple way.</message>
  <tree>45bf90c02dab41abd8997f46fef75610b5f0a65e</tree>
  <committer>
    <name>Guilherme Chapiewski</name>
    <email>guilherme.chapiewski@gmail.com</email>
  </committer>
</commit>
