diff options
| author | Chris McDonough <chrism@plope.com> | 2010-11-10 14:00:06 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-11-10 14:00:06 -0500 |
| commit | 9cca72f267c96221a60a17e7abe4092e36c6efee (patch) | |
| tree | cad69c3ecb27534d3a8bad9791b28c3916ec20d5 | |
| parent | d9143ed992c7f86fe4ed15d8131b29ecb7ea0a71 (diff) | |
| download | pyramid-9cca72f267c96221a60a17e7abe4092e36c6efee.tar.gz pyramid-9cca72f267c96221a60a17e7abe4092e36c6efee.tar.bz2 pyramid-9cca72f267c96221a60a17e7abe4092e36c6efee.zip | |
Features
--------
- Normalized all paster templates: each now uses the name ``main`` to
represent the function that returns a WSGI application, each now uses
WebError, each now has roughly the same shape of development.ini style.
Bug Fixes
---------
- The pylons_* paster templates erroneously used the ``{squiggly}`` routing
syntax as the pattern supplied to ``add_route``. This style of routing is
not supported. They were replaced with ``:colon`` style route patterns.
20 files changed, 68 insertions, 69 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index f53b033fa..9500c0ccb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,19 @@ Next release ============ +Features +-------- + +- Normalized all paster templates: each now uses the name ``main`` to + represent the function that returns a WSGI application, each now uses + WebError, each now has roughly the same shape of development.ini style. + +Bug Fixes +--------- + +- The pylons_* paster templates erroneously used the ``{squiggly}`` routing + syntax as the pattern supplied to ``add_route``. This style of routing is + not supported. They were replaced with ``:colon`` style route patterns. 1.0a2 (2010-11-09) ================== diff --git a/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl b/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl index c3acbe8ae..de03fcf33 100755 --- a/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl @@ -3,11 +3,8 @@ from paste.deploy.converters import asbool from {{package}}.models import appmaker -def app(global_config, **settings): +def main(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: diff --git a/pyramid/paster_templates/alchemy/development.ini_tmpl b/pyramid/paster_templates/alchemy/development.ini_tmpl index 8260104d5..de4605e33 100644 --- a/pyramid/paster_templates/alchemy/development.ini_tmpl +++ b/pyramid/paster_templates/alchemy/development.ini_tmpl @@ -1,8 +1,5 @@ -[DEFAULT] -debug = true - -[app:sqlalchemy] -use = egg:{{package}}#app +[app:{{package}}] +use = egg:{{package}} reload_templates = true debug_authorization = false debug_notfound = false @@ -13,8 +10,9 @@ db_echo = false [pipeline:main] pipeline = + egg:WebError#evalerror egg:repoze.tm2#tm - sqlalchemy + {{package}} [server:main] use = egg:Paste#http diff --git a/pyramid/paster_templates/alchemy/setup.py_tmpl b/pyramid/paster_templates/alchemy/setup.py_tmpl index f6f88ede0..591b57d9d 100644 --- a/pyramid/paster_templates/alchemy/setup.py_tmpl +++ b/pyramid/paster_templates/alchemy/setup.py_tmpl @@ -12,6 +12,7 @@ requires = [ 'repoze.tm2', 'sqlalchemy', 'zope.sqlalchemy', + 'WebError', ] if sys.version_info[:3] < (2,5,0): @@ -30,7 +31,7 @@ setup(name='{{project}}', author='', author_email='', url='', - keywords='web wsgi bfg pylons pyramid', + keywords='web pylons pyramid', packages=find_packages(), include_package_data=True, zip_safe=False, @@ -39,7 +40,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}:app + main = {{package}}:main """, paster_plugins=['pyramid'], ) diff --git a/pyramid/paster_templates/pylons_basic/+package+/__init__.py_tmpl b/pyramid/paster_templates/pylons_basic/+package+/__init__.py_tmpl index 5200e1206..6a8beb1a7 100644 --- a/pyramid/paster_templates/pylons_basic/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/pylons_basic/+package+/__init__.py_tmpl @@ -8,9 +8,8 @@ def main(global_config, **settings): config.begin() session_factory = session_factory_from_settings(settings) config.set_session_factory(session_factory) - # XXX add caching setup config.add_static_view('static', '{{package}}:static/') - config.add_handler('action', '/{action}', + config.add_handler('action', '/:action', '{{package}}.handlers.hello:HelloHandler') config.add_handler('home', '/', '{{package}}.handlers.hello:HelloHandler', action='index') diff --git a/pyramid/paster_templates/pylons_minimal/+package+/__init__.py_tmpl b/pyramid/paster_templates/pylons_minimal/+package+/__init__.py_tmpl index e2f94c6fe..a1a353aae 100644 --- a/pyramid/paster_templates/pylons_minimal/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/pylons_minimal/+package+/__init__.py_tmpl @@ -8,9 +8,8 @@ def main(global_config, **settings): config.begin() session_factory = session_factory_from_settings(settings) config.set_session_factory(session_factory) - # XXX add caching setup config.add_static_view('static', '{{package}}:static/') - config.add_handler('action', '/{action}', '{{package}}.handlers:MyHandler') + config.add_handler('action', '/:action', '{{package}}.handlers:MyHandler') config.add_handler('home', '/', '{{package}}.handlers:MyHandler', action='index') config.add_subscriber('{{package}}.subscribers.add_renderer_globals', diff --git a/pyramid/paster_templates/pylons_sqla/+package+/__init__.py_tmpl b/pyramid/paster_templates/pylons_sqla/+package+/__init__.py_tmpl index 11f7c9642..218c2120b 100644 --- a/pyramid/paster_templates/pylons_sqla/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/pylons_sqla/+package+/__init__.py_tmpl @@ -1,10 +1,10 @@ +from pyramid.configuration import Configurator from pyramid_beaker import session_factory_from_settings +from paste.deploy.converters import asbool def main(global_config, **settings): - """ This function returns a Pylons WSGI application. + """ This function returns a Pyramid WSGI application. """ - from paste.deploy.converters import asbool - from pyramid.configuration import Configurator from {{package}}.models import initialize_sql db_string = settings.get('db_string') if db_string is None: @@ -15,14 +15,13 @@ def main(global_config, **settings): config.begin() session_factory = session_factory_from_settings(settings) config.set_session_factory(session_factory) - # XXX add caching setup config.add_static_view( 'static', '{{package}}:static/' ) config.add_handler( 'main', - '/{action}', + '/:action', '{{package}}.handlers:MyHandler', ) config.add_handler( diff --git a/pyramid/paster_templates/pylons_sqla/setup.py_tmpl b/pyramid/paster_templates/pylons_sqla/setup.py_tmpl index 010d4dd14..578d186f3 100644 --- a/pyramid/paster_templates/pylons_sqla/setup.py_tmpl +++ b/pyramid/paster_templates/pylons_sqla/setup.py_tmpl @@ -33,7 +33,7 @@ setup(name='{{project}}', author='', author_email='', url='', - keywords='web pylons', + keywords='web pyramid pylons', packages=find_packages(), include_package_data=True, zip_safe=False, diff --git a/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl b/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl index 128e4d5d9..d84aaaee7 100644 --- a/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl @@ -3,11 +3,8 @@ 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``. +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. """ db_string = settings.get('db_string') if db_string is None: diff --git a/pyramid/paster_templates/routesalchemy/development.ini_tmpl b/pyramid/paster_templates/routesalchemy/development.ini_tmpl index 8260104d5..de4605e33 100644 --- a/pyramid/paster_templates/routesalchemy/development.ini_tmpl +++ b/pyramid/paster_templates/routesalchemy/development.ini_tmpl @@ -1,8 +1,5 @@ -[DEFAULT] -debug = true - -[app:sqlalchemy] -use = egg:{{package}}#app +[app:{{package}}] +use = egg:{{package}} reload_templates = true debug_authorization = false debug_notfound = false @@ -13,8 +10,9 @@ db_echo = false [pipeline:main] pipeline = + egg:WebError#evalerror egg:repoze.tm2#tm - sqlalchemy + {{package}} [server:main] use = egg:Paste#http diff --git a/pyramid/paster_templates/routesalchemy/setup.py_tmpl b/pyramid/paster_templates/routesalchemy/setup.py_tmpl index 41851482a..80b756214 100644 --- a/pyramid/paster_templates/routesalchemy/setup.py_tmpl +++ b/pyramid/paster_templates/routesalchemy/setup.py_tmpl @@ -13,6 +13,7 @@ requires = [ 'transaction', 'repoze.tm2', 'zope.sqlalchemy', + 'WebError', ] if sys.version_info[:3] < (2,5,0): @@ -39,7 +40,7 @@ setup(name='{{project}}', install_requires = requires, entry_points = """\ [paste.app_factory] - app = {{package}}:app + main = {{package}}:main """, paster_plugins=['pyramid'], ) diff --git a/pyramid/paster_templates/starter/+package+/__init__.py_tmpl b/pyramid/paster_templates/starter/+package+/__init__.py_tmpl index 33c1b5bfd..5957fc71f 100644 --- a/pyramid/paster_templates/starter/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/starter/+package+/__init__.py_tmpl @@ -1,8 +1,8 @@ from pyramid.configuration import Configurator from {{package}}.models import get_root -def app(global_config, **settings): - """ This function returns a WSGI application. +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. It is usually called by the PasteDeploy framework during ``paster serve``. diff --git a/pyramid/paster_templates/starter/development.ini_tmpl b/pyramid/paster_templates/starter/development.ini_tmpl index 9bdeec1ae..5031742db 100644 --- a/pyramid/paster_templates/starter/development.ini_tmpl +++ b/pyramid/paster_templates/starter/development.ini_tmpl @@ -1,14 +1,16 @@ -[DEFAULT] -debug = true - -[app:main] -use = egg:{{project}}#app +[app:{{project}}] +use = egg:{{project}} reload_templates = true debug_authorization = false debug_notfound = false debug_templates = true default_locale_name = en +[pipeline:main] +pipeline = + egg:WebError#evalerror + {{project}} + [server:main] use = egg:Paste#http host = 0.0.0.0 diff --git a/pyramid/paster_templates/starter/setup.py_tmpl b/pyramid/paster_templates/starter/setup.py_tmpl index 774ac031e..bd2642627 100644 --- a/pyramid/paster_templates/starter/setup.py_tmpl +++ b/pyramid/paster_templates/starter/setup.py_tmpl @@ -6,7 +6,7 @@ here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.txt')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() -requires = ['pyramid'] +requires = ['pyramid', 'WebError'] setup(name='{{project}}', version='0.0', @@ -21,7 +21,7 @@ setup(name='{{project}}', author='', author_email='', url='', - keywords='web wsgi bfg pyramid pylons', + keywords='web pyramid pylons', packages=find_packages(), include_package_data=True, zip_safe=False, @@ -30,7 +30,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}:app + main = {{package}}:main """, paster_plugins=['pyramid'], ) diff --git a/pyramid/paster_templates/starter_zcml/+package+/__init__.py_tmpl b/pyramid/paster_templates/starter_zcml/+package+/__init__.py_tmpl index a4e3c1d6e..19f35bee9 100644 --- a/pyramid/paster_templates/starter_zcml/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/starter_zcml/+package+/__init__.py_tmpl @@ -1,11 +1,8 @@ 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``. +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. """ zcml_file = settings.get('configure_zcml', 'configure.zcml') config = Configurator(root_factory=get_root, settings=settings) diff --git a/pyramid/paster_templates/starter_zcml/development.ini_tmpl b/pyramid/paster_templates/starter_zcml/development.ini_tmpl index 9bdeec1ae..5031742db 100644 --- a/pyramid/paster_templates/starter_zcml/development.ini_tmpl +++ b/pyramid/paster_templates/starter_zcml/development.ini_tmpl @@ -1,14 +1,16 @@ -[DEFAULT] -debug = true - -[app:main] -use = egg:{{project}}#app +[app:{{project}}] +use = egg:{{project}} reload_templates = true debug_authorization = false debug_notfound = false debug_templates = true default_locale_name = en +[pipeline:main] +pipeline = + egg:WebError#evalerror + {{project}} + [server:main] use = egg:Paste#http host = 0.0.0.0 diff --git a/pyramid/paster_templates/starter_zcml/setup.py_tmpl b/pyramid/paster_templates/starter_zcml/setup.py_tmpl index 774ac031e..bd2642627 100644 --- a/pyramid/paster_templates/starter_zcml/setup.py_tmpl +++ b/pyramid/paster_templates/starter_zcml/setup.py_tmpl @@ -6,7 +6,7 @@ here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.txt')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() -requires = ['pyramid'] +requires = ['pyramid', 'WebError'] setup(name='{{project}}', version='0.0', @@ -21,7 +21,7 @@ setup(name='{{project}}', author='', author_email='', url='', - keywords='web wsgi bfg pyramid pylons', + keywords='web pyramid pylons', packages=find_packages(), include_package_data=True, zip_safe=False, @@ -30,7 +30,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}:app + main = {{package}}:main """, paster_plugins=['pyramid'], ) diff --git a/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl b/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl index 7b6188001..b6e21c886 100644 --- a/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl +++ b/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl @@ -2,11 +2,8 @@ from pyramid.configuration import Configurator from repoze.zodbconn.finder import PersistentApplicationFinder from {{package}}.models import appmaker -def app(global_config, **settings): +def main(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') diff --git a/pyramid/paster_templates/zodb/development.ini_tmpl b/pyramid/paster_templates/zodb/development.ini_tmpl index 993cec596..85a0681b7 100644 --- a/pyramid/paster_templates/zodb/development.ini_tmpl +++ b/pyramid/paster_templates/zodb/development.ini_tmpl @@ -1,8 +1,5 @@ -[DEFAULT] -debug = true - -[app:zodb] -use = egg:{{project}}#app +[app:{{project}}] +use = egg:{{project}} reload_templates = true debug_authorization = false debug_notfound = false @@ -12,9 +9,10 @@ zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000 [pipeline:main] pipeline = + egg:WebError#evalerror egg:repoze.zodbconn#closer egg:repoze.tm#tm - zodb + {{project}} [server:main] use = egg:Paste#http diff --git a/pyramid/paster_templates/zodb/setup.py_tmpl b/pyramid/paster_templates/zodb/setup.py_tmpl index 896fff60d..cd1de15de 100644 --- a/pyramid/paster_templates/zodb/setup.py_tmpl +++ b/pyramid/paster_templates/zodb/setup.py_tmpl @@ -11,6 +11,7 @@ requires = [ 'repoze.zodbconn', 'repoze.tm', 'ZODB3', + 'WebError', ] setup(name='{{project}}', @@ -26,7 +27,7 @@ setup(name='{{project}}', author='', author_email='', url='', - keywords='web wsgi bfg pylons pyramid', + keywords='web pylons pyramid', packages=find_packages(), include_package_data=True, zip_safe=False, @@ -35,7 +36,7 @@ setup(name='{{project}}', test_suite="{{package}}", entry_points = """\ [paste.app_factory] - app = {{package}}:app + main = {{package}}:main """, paster_plugins=['pyramid'], ) |
