From 2617211f3863f503236fae0894c0e475abee9fc8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 10 Jun 2012 23:07:09 -0500 Subject: [PATCH] added pyramid subpackage to scaffold --- .../edbob/+package+/__init__.py_tmpl | 52 ---------------- .../edbob/+package+/pyramid/__init__.py | 57 ++++++++++++++++++ .../{ => pyramid}/static/favicon.ico | Bin .../+package+/{ => pyramid}/static/robots.txt | 0 .../{ => pyramid}/subscribers.py_tmpl | 2 +- .../{ => pyramid}/templates/base.mako_tmpl | 16 ++--- .../{ => pyramid}/templates/home.mako_tmpl | 26 ++++---- .../{ => pyramid}/templates/index.mako | 4 +- .../{ => pyramid}/views/__init__.py_tmpl | 2 +- 9 files changed, 82 insertions(+), 77 deletions(-) create mode 100644 edbob/scaffolds/edbob/+package+/pyramid/__init__.py rename edbob/scaffolds/edbob/+package+/{ => pyramid}/static/favicon.ico (100%) rename edbob/scaffolds/edbob/+package+/{ => pyramid}/static/robots.txt (100%) rename edbob/scaffolds/edbob/+package+/{ => pyramid}/subscribers.py_tmpl (85%) rename edbob/scaffolds/edbob/+package+/{ => pyramid}/templates/base.mako_tmpl (97%) rename edbob/scaffolds/edbob/+package+/{ => pyramid}/templates/home.mako_tmpl (94%) rename edbob/scaffolds/edbob/+package+/{ => pyramid}/templates/index.mako (96%) rename edbob/scaffolds/edbob/+package+/{ => pyramid}/views/__init__.py_tmpl (96%) diff --git a/edbob/scaffolds/edbob/+package+/__init__.py_tmpl b/edbob/scaffolds/edbob/+package+/__init__.py_tmpl index 89983ff..2f7a5da 100644 --- a/edbob/scaffolds/edbob/+package+/__init__.py_tmpl +++ b/edbob/scaffolds/edbob/+package+/__init__.py_tmpl @@ -4,56 +4,4 @@ ``{{package}}`` -- {{project}} application """ -import os.path - -from pyramid.config import Configurator -from pyramid.authentication import SessionAuthenticationPolicy - -import edbob -from edbob.pyramid.auth import EdbobAuthorizationPolicy - from {{package}}._version import __version__ - - -def main(global_config, **settings): - """ - This function returns a Pyramid WSGI application. - """ - - # Here you can insert any code to modify the ``settings`` dict. - # You can: - # * Add additional keys to serve as constants or "global variables" in the - # application. - # * Set default values for settings that may have been omitted. - # * Override settings that you don't want the user to change. - # * Raise an exception if a setting is missing or invalid. - # * Convert values from strings to their intended type. - - settings['mako.directories'] = [ - '{{package}}:templates', - 'edbob.pyramid:templates', - ] - - config = Configurator(settings=settings) - - # Configure session - config.include('pyramid_beaker') - - # Configure auth - config.set_authentication_policy(SessionAuthenticationPolicy()) - config.set_authorization_policy(EdbobAuthorizationPolicy()) - - # Include "core" stuff provided by edbob. - config.include('edbob.pyramid') - - # Additional config is defined elsewhere within {{project}}. This includes - # incorporating the various views etc. exposed by other packages. - config.include('{{package}}.subscribers') - config.include('{{package}}.views') - - # Configure edbob. Note that this is done last, primarily to allow logging - # to leverage edbob's config inheritance. - edbob.basic_logging() - edbob.init('{{package}}', os.path.abspath(settings['edbob.config'])) - - return config.make_wsgi_app() diff --git a/edbob/scaffolds/edbob/+package+/pyramid/__init__.py b/edbob/scaffolds/edbob/+package+/pyramid/__init__.py new file mode 100644 index 0000000..134e5ab --- /dev/null +++ b/edbob/scaffolds/edbob/+package+/pyramid/__init__.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +""" +``{{package}}.pyramid`` -- Pyramid Application +""" + +import os.path + +from pyramid.config import Configurator +from pyramid.authentication import SessionAuthenticationPolicy + +import edbob +from edbob.pyramid.auth import EdbobAuthorizationPolicy + + +def main(global_config, **settings): + """ + This function returns a Pyramid WSGI application. + """ + + # Here you can insert any code to modify the ``settings`` dict. + # You can: + # * Add additional keys to serve as constants or "global variables" in the + # application. + # * Set default values for settings that may have been omitted. + # * Override settings that you don't want the user to change. + # * Raise an exception if a setting is missing or invalid. + # * Convert values from strings to their intended type. + + settings['mako.directories'] = [ + '{{package}}.pyramid:templates', + 'edbob.pyramid:templates', + ] + + config = Configurator(settings=settings) + + # Configure session + config.include('pyramid_beaker') + + # Configure auth + config.set_authentication_policy(SessionAuthenticationPolicy()) + config.set_authorization_policy(EdbobAuthorizationPolicy()) + + # Include "core" stuff provided by edbob. + config.include('edbob.pyramid') + + # Additional config is defined elsewhere within {{project}}. This includes + # incorporating the various views etc. exposed by other packages. + config.include('{{package}}.pyramid.subscribers') + config.include('{{package}}.pyramid.views') + + # Configure edbob. Note that this is done last, primarily to allow logging + # to leverage edbob's config inheritance. + edbob.basic_logging() + edbob.init('{{package}}', os.path.abspath(settings['edbob.config'])) + + return config.make_wsgi_app() diff --git a/edbob/scaffolds/edbob/+package+/static/favicon.ico b/edbob/scaffolds/edbob/+package+/pyramid/static/favicon.ico similarity index 100% rename from edbob/scaffolds/edbob/+package+/static/favicon.ico rename to edbob/scaffolds/edbob/+package+/pyramid/static/favicon.ico diff --git a/edbob/scaffolds/edbob/+package+/static/robots.txt b/edbob/scaffolds/edbob/+package+/pyramid/static/robots.txt similarity index 100% rename from edbob/scaffolds/edbob/+package+/static/robots.txt rename to edbob/scaffolds/edbob/+package+/pyramid/static/robots.txt diff --git a/edbob/scaffolds/edbob/+package+/subscribers.py_tmpl b/edbob/scaffolds/edbob/+package+/pyramid/subscribers.py_tmpl similarity index 85% rename from edbob/scaffolds/edbob/+package+/subscribers.py_tmpl rename to edbob/scaffolds/edbob/+package+/pyramid/subscribers.py_tmpl index 5903d31..60170a2 100644 --- a/edbob/scaffolds/edbob/+package+/subscribers.py_tmpl +++ b/edbob/scaffolds/edbob/+package+/pyramid/subscribers.py_tmpl @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -``{{package}}.subscribers`` -- Pyramid Event Subscribers +``{{package}}.pyramid.subscribers`` -- Pyramid Event Subscribers """ import {{package}} diff --git a/edbob/scaffolds/edbob/+package+/templates/base.mako_tmpl b/edbob/scaffolds/edbob/+package+/pyramid/templates/base.mako_tmpl similarity index 97% rename from edbob/scaffolds/edbob/+package+/templates/base.mako_tmpl rename to edbob/scaffolds/edbob/+package+/pyramid/templates/base.mako_tmpl index d1d8eeb..f4746cd 100644 --- a/edbob/scaffolds/edbob/+package+/templates/base.mako_tmpl +++ b/edbob/scaffolds/edbob/+package+/pyramid/templates/base.mako_tmpl @@ -1,8 +1,8 @@ -<%inherit file="/edbob/base.mako" /> -<%def name="global_title()">{{project}} -<%def name="home_link()">

${h.link_to("{{project}}", url('home'))}

-<%def name="footer()"> - {{project}} v${ {{package}}.__version__} powered by - ${h.link_to("edbob", 'http://edbob.org/', target='_blank')} v${edbob.__version__} - -${parent.body()} +<%inherit file="/edbob/base.mako" /> +<%def name="global_title()">{{project}} +<%def name="home_link()">

${h.link_to("{{project}}", url('home'))}

+<%def name="footer()"> + {{project}} v${ {{package}}.__version__} powered by + ${h.link_to("edbob", 'http://edbob.org/', target='_blank')} v${edbob.__version__} + +${parent.body()} diff --git a/edbob/scaffolds/edbob/+package+/templates/home.mako_tmpl b/edbob/scaffolds/edbob/+package+/pyramid/templates/home.mako_tmpl similarity index 94% rename from edbob/scaffolds/edbob/+package+/templates/home.mako_tmpl rename to edbob/scaffolds/edbob/+package+/pyramid/templates/home.mako_tmpl index 08c7fb5..c8b919c 100644 --- a/edbob/scaffolds/edbob/+package+/templates/home.mako_tmpl +++ b/edbob/scaffolds/edbob/+package+/pyramid/templates/home.mako_tmpl @@ -1,13 +1,13 @@ -<%inherit file="/base.mako" /> - -<%def name="title()">Home - -

Welcome to {{project}}

- -

You must choose, but choose wisely:

-
- - +<%inherit file="/base.mako" /> + +<%def name="title()">Home + +

Welcome to {{project}}

+ +

You must choose, but choose wisely:

+
+ + diff --git a/edbob/scaffolds/edbob/+package+/templates/index.mako b/edbob/scaffolds/edbob/+package+/pyramid/templates/index.mako similarity index 96% rename from edbob/scaffolds/edbob/+package+/templates/index.mako rename to edbob/scaffolds/edbob/+package+/pyramid/templates/index.mako index 4476c59..f7a178f 100644 --- a/edbob/scaffolds/edbob/+package+/templates/index.mako +++ b/edbob/scaffolds/edbob/+package+/pyramid/templates/index.mako @@ -1,2 +1,2 @@ -<%inherit file="/edbob/index.mako" /> -${parent.body()} +<%inherit file="/edbob/index.mako" /> +${parent.body()} diff --git a/edbob/scaffolds/edbob/+package+/views/__init__.py_tmpl b/edbob/scaffolds/edbob/+package+/pyramid/views/__init__.py_tmpl similarity index 96% rename from edbob/scaffolds/edbob/+package+/views/__init__.py_tmpl rename to edbob/scaffolds/edbob/+package+/pyramid/views/__init__.py_tmpl index 86a1696..18a27ae 100644 --- a/edbob/scaffolds/edbob/+package+/views/__init__.py_tmpl +++ b/edbob/scaffolds/edbob/+package+/pyramid/views/__init__.py_tmpl @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -``{{package}}.views`` -- Views +``{{package}}.pyramid.views`` -- Views """ import os