Commits

Chris McDonough committed a6d3a4e Merge

Comments (0)

Files changed (5)

 -----------
 - ``add_static_route`` is now a Pyramid config method if you call the new
   ``includeme`` function. This is used in the application template.
+- Add ``pyramid_sqla`` as a dependency in the application template.
+- Delete websetup.py. Console scripts are more flexible than "paster
+  setup-app".
+- Fix but that may have prevented create_db.py from finding the INI stanza.
 - 100% test coverage contributed by Chris McDonough.
 - Delete unneeded development code in static.py.
 

pyramid_sqla/paster_templates/pyramid_sqla/+package+/scripts/create_db.py_tmpl

     ini_file = sys.argv[1]
     logging.config.fileConfig(ini_file)
     log = logging.getLogger(__name__)
-    app = get_app(ini_file, "SimpleDemo")
+    app = get_app(ini_file, "{{project}}")
     #settings = app.registry.settings
 
     # Abort if any tables exist to prevent accidental overwriting

pyramid_sqla/paster_templates/pyramid_sqla/+package+/websetup.py_tmpl

-import logging
-
-import pyramid_sqla as psa
-import transaction
-
-import {{package}}
-import {{package}}.models as models
-
-def setup_app(command, conf, vars):
-    # Initialize logging
-    command.logging_file_config(conf.filename)
-    log = logging.getLogger(__name__)
-
-    # Load the application
-    app = {{package}}.main(conf.global_conf, **conf.local_conf)
-    #settings = app.registry.settings
-
-    # Abort if any table exists
-    for table in models.Base.metadata.sorted_tables:
-        log.debug("checking if table '%s' exists", table.name)
-        if table.exists():
-            raise RuntimeError("database table '%s' exists"  % table.name)
-
-    # Create all tables
-    models.Base.metadata.create_all()
-    sess = models.Session()
-
-    # Record 1
-    #p = models.Page(title="FrontPage", content="Edit me.")
-    #sess.add(p)
-
-    transaction.commit()

pyramid_sqla/paster_templates/pyramid_sqla/setup.py

     'pyramid>=1.0a10',
     'pyramid_beaker',
     'pyramid_handlers',
+    'pyramid_sqla',
     'SQLAlchemy',
     'transaction',
     'repoze.tm2>=1.0b1',  # default_commit_veto

pyramid_sqla/static.py

       This should be a relative directory with '/' separators regardless of
       platform. 
 
-    * ``directory``: a Pyramid asset specification ("mypackage:static") or an
-      absolute directory. An asset specification is preferred because it will
-      automatically adjust if the application is moved to another directory.
-
     * ``cache_max_age``: influences the ``Expires`` and ``Max-Age``
       response headers returned by the view (default is 3600 seconds or five
       minutes).