added pyramid subpackage to scaffold
This commit is contained in:
parent
ba092f90e4
commit
2617211f38
9 changed files with 82 additions and 77 deletions
|
@ -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()
|
||||
|
|
57
edbob/scaffolds/edbob/+package+/pyramid/__init__.py
Normal file
57
edbob/scaffolds/edbob/+package+/pyramid/__init__.py
Normal file
|
@ -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()
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
``{{package}}.subscribers`` -- Pyramid Event Subscribers
|
||||
``{{package}}.pyramid.subscribers`` -- Pyramid Event Subscribers
|
||||
"""
|
||||
|
||||
import {{package}}
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
``{{package}}.views`` -- Views
|
||||
``{{package}}.pyramid.views`` -- Views
|
||||
"""
|
||||
|
||||
import os
|
Loading…
Add table
Add a link
Reference in a new issue