Commits

Graham Higgins committed 578e75a

Tagging Pylons 1.0 version

Comments (0)

Files changed (4)

 # The short X.Y version.
 version = '0.4'
 # The full version, including alpha/beta/rc tags.
-release = '0.4.3'
+release = '0.4.4'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 Status
 ------
 
-Shabti has managed to lurch its way up to version 0.4.3
+Shabti has managed to lurch its way up to version 0.4.4
 
 Credits
 -------
 
 from setuptools import setup, find_packages
 
-version = '0.4.2'
+version = '0.4.4'
 
 setup(
     name= 'Shabti',
                     "repozewhat" : ["repoze.who>=1.0.10", "repoze.what>=1.0.8"],
                     "repozepylons" : ["repoze.who>=1.0.10", "repoze.what>=1.0.8",
                                       "repoze.what_pylons>=1.0", 
+                                      "repoze.what_quickstart>=1.0.6",
                                       "FormAlchemy", "fa.jquery>=0.6"],
                     "microsite" : ["Babel>=0.9.4", "ToscaWidgets>=0.9.4",
                                    "tw.forms>=0.9.3dev-20090122"],

shabti/commands.py

 except ImportError:
     use_migrate = False
 
-
 class SqlCommand(Command):
     
     min_args = 1
                       help="Perform action only on given table")
     
     def command(self):
-        
         try:
             
             self.config_file = os.path.abspath(self.args[0])
             
             app = deploy.loadapp('config:' + self.config_file)
             
+            # additional imports ...
+            package = __import__(base_package + '.config.environment')
+            environment = package.config.environment
+            
+            here_dir = os.path.dirname(__file__)
+            conf_dir = os.path.dirname(os.path.dirname(here_dir))
+            
+            config_file = os.path.join(conf_dir, self.config_file)
+            conf = deploy.appconfig('config:' + config_file)
+            pylonsconfig = environment.load_environment(conf.global_conf, conf.local_conf)
+            
             from sqlalchemy import engine_from_config
             engine = engine_from_config(pylonsconfig, 'sqlalchemy.')
             
             model.init_model(engine)
-            
             metadata = model.metadata
             
             try:
             self.sql_command(metadata, table)
         
         except BadCommand, e:
-            raise BadCommand('An error occurred. %s' % e)
+            raise BadCommand('paster: an error occurred. %s' % e)
         except:
             msg = str(sys.exc_info()[1])
-            raise BadCommand('An unknown error occurred. %s' % msg)
+            raise BadCommand('paster: an unknown error occurred. %s' % msg)
     
 
 class CreateSqlCommand(SqlCommand):
         if self.options.setup:
             cmd = SetupCommand('setup-app')
             cmd.run([self.config_file])
+    
 
 class DropSqlCommand(SqlCommand):
     """Drop all model tables, or a single table
             if self.options.setup:
                 cmd = SetupCommand('setup-app')
                 cmd.run([self.config_file])
+    
 
 class ModelCommand(Command):
     """Create a Model and accompanying unit test
         repository = self.options.repository or os.path.join(package_name, 'repository')
         try:
             migrate_api.create(repository, package_name, table = self.options.version_table)
-        except KnownError:
+        # except KnownError:
+        except:
             pass # repository already created
         
         # add database to version control
         dburi = self.options.dburi or pylonsconfig.get('sqlalchemy.default.uri')
         try:
             migrate_api.version_control(dburi, repository)
-        except DatabaseAlreadyControlledError:
+        # except DatabaseAlreadyControlledError:
+        except:
             pass # database already under control
         
         # run command using pattern _<cmd>_command
         if result: print result
     
     def _script_command(self, dburi, repository, version, script_path):
-        return migrate_api.script(script_path)
+        return migrate_api.script(script_path, repository)
     
     def _commit_command(self, dburi, repository, version, script_path, database=None, operation = None):
         return migrate_api.commit(script_path, repository, database=database, operation=operation, version = version)
     
     def _test_command(self, dburi, repository, version, script_path):
-        return migrate_api.test(script_path, repository, dburi)
+        return migrate_api.test(script_path, repository, dburi=dburi)
     
     def _version_command(self, dburi, repository, version):
         return migrate_api.version(repository)