summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bangert <ben@groovie.org>2010-11-03 17:24:04 -0700
committerBen Bangert <ben@groovie.org>2010-11-03 17:24:04 -0700
commit20fbdee307e554c2cd44c54fb7860a0ca0a8e19b (patch)
tree8f0dc34c4bb9ded8b4adf7af0a5b5a0b005f1c46
parent96d7897c0bc86c25afb861fb2ee61d5e4351b0dc (diff)
downloadpyramid-20fbdee307e554c2cd44c54fb7860a0ca0a8e19b.tar.gz
pyramid-20fbdee307e554c2cd44c54fb7860a0ca0a8e19b.tar.bz2
pyramid-20fbdee307e554c2cd44c54fb7860a0ca0a8e19b.zip
Revert "Changed to use imperative config."
This reverts commit 84e445db4cce4d9f29bf76efa73291c48989267c.
-rw-r--r--pyramid/paster_templates/alchemy/+package+/configure.zcml23
-rw-r--r--pyramid/paster_templates/alchemy/+package+/run.py_tmpl7
2 files changed, 25 insertions, 5 deletions
diff --git a/pyramid/paster_templates/alchemy/+package+/configure.zcml b/pyramid/paster_templates/alchemy/+package+/configure.zcml
new file mode 100644
index 000000000..9450b9049
--- /dev/null
+++ b/pyramid/paster_templates/alchemy/+package+/configure.zcml
@@ -0,0 +1,23 @@
+<configure xmlns="http://pylonshq.com/pyramid">
+
+ <!-- this must be included for the view declarations to work -->
+ <include package="pyramid.includes" />
+
+ <view
+ context=".models.MyApp"
+ view=".views.view_root"
+ renderer="templates/root.pt"
+ />
+
+ <view
+ context=".models.MyModel"
+ view=".views.view_model"
+ renderer="templates/model.pt"
+ />
+
+ <static
+ name="static"
+ path="templates/static"
+ />
+
+</configure>
diff --git a/pyramid/paster_templates/alchemy/+package+/run.py_tmpl b/pyramid/paster_templates/alchemy/+package+/run.py_tmpl
index 2e349f482..610b9ed2d 100644
--- a/pyramid/paster_templates/alchemy/+package+/run.py_tmpl
+++ b/pyramid/paster_templates/alchemy/+package+/run.py_tmpl
@@ -9,6 +9,7 @@ def app(global_config, **settings):
It is usually called by the PasteDeploy framework during
``paster serve``.
"""
+ zcml_file = settings.get('configure_zcml', 'configure.zcml')
db_string = settings.get('db_string')
if db_string is None:
raise ValueError("No 'db_string' value in application configuration.")
@@ -16,11 +17,7 @@ def app(global_config, **settings):
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('.views.view_root', context='.models.MyApp',
- renderer="templates/root.pt")
- config.add_view('.views.view_model', context='.models.MyModel',
- renderer="templates/model.pt")
+ config.load_zcml(zcml_file)
config.end()
return config.make_wsgi_app()