diff options
| author | Chris McDonough <chrism@plope.com> | 2010-11-04 00:54:57 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-11-04 00:54:57 -0400 |
| commit | 896e2523fbb391bb1a04f9f2ec05a674b9ba7fdf (patch) | |
| tree | 165adca9190687f5ec2e65926b1b49dcb25536b4 | |
| parent | ed4a7dc107690978eb760af2bc1b13ca0d19e6f4 (diff) | |
| download | pyramid-896e2523fbb391bb1a04f9f2ec05a674b9ba7fdf.tar.gz pyramid-896e2523fbb391bb1a04f9f2ec05a674b9ba7fdf.tar.bz2 pyramid-896e2523fbb391bb1a04f9f2ec05a674b9ba7fdf.zip | |
- Convert all paster templates except 'starter' to be imperative.
- Paster templates no longer contain a ``run`` module; setup code is
in __init__.
- {{package}}.ini is now always development.ini
17 files changed, 4 insertions, 200 deletions
diff --git a/pyramid/paster_templates/alchemy/+package+/__init__.py b/pyramid/paster_templates/alchemy/+package+/__init__.py deleted file mode 100755 index cbdfd3ac6..000000000 --- a/pyramid/paster_templates/alchemy/+package+/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# A package - diff --git a/pyramid/paster_templates/alchemy/+package+/run.py_tmpl b/pyramid/paster_templates/alchemy/+package+/run.py_tmpl deleted file mode 100644 index 2a0eaa5b7..000000000 --- a/pyramid/paster_templates/alchemy/+package+/run.py_tmpl +++ /dev/null @@ -1,28 +0,0 @@ -from pyramid.configuration import Configurator -from paste.deploy.converters import asbool - -from {{package}}.models import appmaker - -def app(global_config, **settings): - """ This function returns a WSGI application. - - It is usually called by the PasteDeploy framework during - ``paster serve``. - """ - db_string = settings.get('db_string') - if db_string is None: - raise ValueError("No 'db_string' value in application configuration.") - db_echo = settings.get('db_echo', 'false') - get_root = appmaker(db_string, asbool(db_echo)) - config = Configurator(settings=settings, root_factory=get_root) - config.begin() - config.add_static_view('static', 'templates/static') - config.add_view('{{package}}.views.view_root', - context='{{package}}.models.MyApp', - renderer="templates/root.pt") - config.add_view('{{package}}.views.view_model', - context='{{package}}.models.MyModel', - renderer="templates/model.pt") - config.end() - return config.make_wsgi_app() - diff --git a/pyramid/paster_templates/alchemy/+project+.ini_tmpl b/pyramid/paster_templates/alchemy/+project+.ini_tmpl deleted file mode 100644 index 8260104d5..000000000 --- a/pyramid/paster_templates/alchemy/+project+.ini_tmpl +++ /dev/null @@ -1,22 +0,0 @@ -[DEFAULT] -debug = true - -[app:sqlalchemy] -use = egg:{{package}}#app -reload_templates = true -debug_authorization = false -debug_notfound = false -debug_templates = true -default_locale_name = en -db_string = sqlite:///%(here)s/{{package}}.db -db_echo = false - -[pipeline:main] -pipeline = - egg:repoze.tm2#tm - sqlalchemy - -[server:main] -use = egg:Paste#http -host = 0.0.0.0 -port = 6543 diff --git a/pyramid/paster_templates/alchemy/setup.py_tmpl b/pyramid/paster_templates/alchemy/setup.py_tmpl index fe75017a5..e685ddda2 100644 --- a/pyramid/paster_templates/alchemy/setup.py_tmpl +++ b/pyramid/paster_templates/alchemy/setup.py_tmpl @@ -39,7 +39,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}.run:app + app = {{package}}:app """ ) diff --git a/pyramid/paster_templates/routesalchemy/+package+/__init__.py b/pyramid/paster_templates/routesalchemy/+package+/__init__.py deleted file mode 100644 index cbdfd3ac6..000000000 --- a/pyramid/paster_templates/routesalchemy/+package+/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# A package - diff --git a/pyramid/paster_templates/routesalchemy/+package+/run.py_tmpl b/pyramid/paster_templates/routesalchemy/+package+/run.py_tmpl deleted file mode 100644 index c9e12a3fb..000000000 --- a/pyramid/paster_templates/routesalchemy/+package+/run.py_tmpl +++ /dev/null @@ -1,24 +0,0 @@ -from pyramid.configuration import Configurator -from paste.deploy.converters import asbool - -from {{package}}.models import initialize_sql - -def app(global_config, **settings): - """ This function returns a WSGI application. - - It is usually called by the PasteDeploy framework during - ``paster serve``. - """ - db_string = settings.get('db_string') - if db_string is None: - raise ValueError("No 'db_string' value in application configuration.") - db_echo = settings.get('db_echo', 'false') - initialize_sql(db_string, asbool(db_echo)) - config = Configurator(settings=settings) - config.begin() - config.add_static_view('static', 'templates/static') - config.add_route('home', '/', view='{{package}}.views.my_view', - renderer='templates/mytemplate.pt') - config.end() - return config.make_wsgi_app() - diff --git a/pyramid/paster_templates/routesalchemy/+project+.ini_tmpl b/pyramid/paster_templates/routesalchemy/+project+.ini_tmpl deleted file mode 100644 index 8260104d5..000000000 --- a/pyramid/paster_templates/routesalchemy/+project+.ini_tmpl +++ /dev/null @@ -1,22 +0,0 @@ -[DEFAULT] -debug = true - -[app:sqlalchemy] -use = egg:{{package}}#app -reload_templates = true -debug_authorization = false -debug_notfound = false -debug_templates = true -default_locale_name = en -db_string = sqlite:///%(here)s/{{package}}.db -db_echo = false - -[pipeline:main] -pipeline = - egg:repoze.tm2#tm - sqlalchemy - -[server:main] -use = egg:Paste#http -host = 0.0.0.0 -port = 6543 diff --git a/pyramid/paster_templates/routesalchemy/setup.py_tmpl b/pyramid/paster_templates/routesalchemy/setup.py_tmpl index 96cd73304..0bd1a5fef 100644 --- a/pyramid/paster_templates/routesalchemy/setup.py_tmpl +++ b/pyramid/paster_templates/routesalchemy/setup.py_tmpl @@ -39,7 +39,7 @@ setup(name='{{project}}', install_requires = requires, entry_points = """\ [paste.app_factory] - app = {{package}}.run:app + app = {{package}}:app """ ) diff --git a/pyramid/paster_templates/starter/+package+/__init__.py b/pyramid/paster_templates/starter/+package+/__init__.py deleted file mode 100644 index cbdfd3ac6..000000000 --- a/pyramid/paster_templates/starter/+package+/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# A package - diff --git a/pyramid/paster_templates/starter/+package+/run.py_tmpl b/pyramid/paster_templates/starter/+package+/run.py_tmpl deleted file mode 100644 index 0ba646e43..000000000 --- a/pyramid/paster_templates/starter/+package+/run.py_tmpl +++ /dev/null @@ -1,15 +0,0 @@ -from pyramid.configuration import Configurator -from {{package}}.models import get_root - -def app(global_config, **settings): - """ This function returns a WSGI application. - - It is usually called by the PasteDeploy framework during - ``paster serve``. - """ - zcml_file = settings.get('configure_zcml', 'configure.zcml') - config = Configurator(root_factory=get_root, settings=settings) - config.begin() - config.load_zcml(zcml_file) - config.end() - return config.make_wsgi_app() diff --git a/pyramid/paster_templates/starter/+project+.ini_tmpl b/pyramid/paster_templates/starter/+project+.ini_tmpl deleted file mode 100644 index 9bdeec1ae..000000000 --- a/pyramid/paster_templates/starter/+project+.ini_tmpl +++ /dev/null @@ -1,15 +0,0 @@ -[DEFAULT] -debug = true - -[app:main] -use = egg:{{project}}#app -reload_templates = true -debug_authorization = false -debug_notfound = false -debug_templates = true -default_locale_name = en - -[server:main] -use = egg:Paste#http -host = 0.0.0.0 -port = 6543 diff --git a/pyramid/paster_templates/starter/setup.py_tmpl b/pyramid/paster_templates/starter/setup.py_tmpl index 8714ac293..7b33177e5 100644 --- a/pyramid/paster_templates/starter/setup.py_tmpl +++ b/pyramid/paster_templates/starter/setup.py_tmpl @@ -30,7 +30,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}.run:app + app = {{package}}:app """ ) diff --git a/pyramid/paster_templates/zodb/+package+/__init__.py b/pyramid/paster_templates/zodb/+package+/__init__.py deleted file mode 100644 index cbdfd3ac6..000000000 --- a/pyramid/paster_templates/zodb/+package+/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# A package - diff --git a/pyramid/paster_templates/zodb/+package+/configure.zcml b/pyramid/paster_templates/zodb/+package+/configure.zcml deleted file mode 100644 index 29d577d3e..000000000 --- a/pyramid/paster_templates/zodb/+package+/configure.zcml +++ /dev/null @@ -1,17 +0,0 @@ -<configure xmlns="http://pylonshq.com/pyramid"> - - <!-- this must be included for the view declarations to work --> - <include package="pyramid.includes" /> - - <view - context=".models.MyModel" - view=".views.my_view" - renderer="templates/mytemplate.pt" - /> - - <static - name="static" - path="templates/static" - /> - -</configure> diff --git a/pyramid/paster_templates/zodb/+package+/run.py_tmpl b/pyramid/paster_templates/zodb/+package+/run.py_tmpl deleted file mode 100644 index 7b6188001..000000000 --- a/pyramid/paster_templates/zodb/+package+/run.py_tmpl +++ /dev/null @@ -1,23 +0,0 @@ -from pyramid.configuration import Configurator -from repoze.zodbconn.finder import PersistentApplicationFinder -from {{package}}.models import appmaker - -def app(global_config, **settings): - """ This function returns a WSGI application. - - It is usually called by the PasteDeploy framework during - ``paster serve``. - """ - zodb_uri = settings.get('zodb_uri') - zcml_file = settings.get('configure_zcml', 'configure.zcml') - if zodb_uri is None: - raise ValueError("No 'zodb_uri' in application configuration.") - - finder = PersistentApplicationFinder(zodb_uri, appmaker) - def get_root(request): - return finder(request.environ) - config = Configurator(root_factory=get_root, settings=settings) - config.begin() - config.load_zcml(zcml_file) - config.end() - return config.make_wsgi_app() diff --git a/pyramid/paster_templates/zodb/+project+.ini_tmpl b/pyramid/paster_templates/zodb/+project+.ini_tmpl deleted file mode 100644 index 993cec596..000000000 --- a/pyramid/paster_templates/zodb/+project+.ini_tmpl +++ /dev/null @@ -1,22 +0,0 @@ -[DEFAULT] -debug = true - -[app:zodb] -use = egg:{{project}}#app -reload_templates = true -debug_authorization = false -debug_notfound = false -debug_templates = true -default_locale_name = en -zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000 - -[pipeline:main] -pipeline = - egg:repoze.zodbconn#closer - egg:repoze.tm#tm - zodb - -[server:main] -use = egg:Paste#http -host = 0.0.0.0 -port = 6543 diff --git a/pyramid/paster_templates/zodb/setup.py_tmpl b/pyramid/paster_templates/zodb/setup.py_tmpl index e2027babd..d14195d93 100644 --- a/pyramid/paster_templates/zodb/setup.py_tmpl +++ b/pyramid/paster_templates/zodb/setup.py_tmpl @@ -35,7 +35,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}.run:app + app = {{package}}:app """ ) |
