Skip to content

Commit

Permalink
fix wiki tutorial based on changes to zodb paster template
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Nov 10, 2010
1 parent a3ceb6c commit c44c409
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 62 deletions.
14 changes: 7 additions & 7 deletions docs/tutorials/wiki/basiclayout.rst
Expand Up @@ -30,32 +30,32 @@ entry point happens to be the ``app`` function within the file named
:linenos:
:language: py

#. *Lines 1-2*. Perform some dependency imports.
#. *Lines 1-3*. Perform some dependency imports.

#. *Line 12*. Get the ZODB configuration from the ``development.ini``
#. *Line 8*. Get the ZODB configuration from the ``development.ini``
file's ``[app:main]`` section represented by the ``settings``
dictionary passed to our ``app`` function. This will be a URI
(something like ``file:///path/to/Data.fs``).

#. *Line 15*. We create a "finder" object using the
#. *Line 12*. We create a "finder" object using the
``PersistentApplicationFinder`` helper class, passing it the ZODB
URI and the "appmaker" we've imported from ``models.py``.

#. *Lines 16 - 17*. We create a :term:`root factory` which uses the
#. *Lines 13 - 14*. We create a :term:`root factory` which uses the
finder to return a ZODB root object.

#. *Line 18*. We construct a :term:`Configurator` with a :term:`root
#. *Line 15*. We construct a :term:`Configurator` with a :term:`root
factory` and the settings keywords parsed by PasteDeploy. The root
factory is named ``get_root``.

#. *Lines 19-21*. Begin configuration using the ``begin`` method of
#. *Lines 16-18*. Begin configuration using the ``begin`` method of
the :meth:`pyramid.configuration.Configurator` class, load the
``configure.zcml`` file from our package using the
:meth:`pyramid.configuration.Configurator.load_zcml` method, and
end configuration using the
:meth:`pyramid.configuration.Configurator.end` method.

#. *Line 22*. Use the
#. *Line 19*. Use the
:meth:`pyramid.configuration.Configurator.make_wsgi_app` method
to return a :term:`WSGI` application.

Expand Down
9 changes: 3 additions & 6 deletions docs/tutorials/wiki/src/authorization/development.ini
@@ -1,8 +1,5 @@
[DEFAULT]
debug = true

[app:zodb]
use = egg:tutorial#app
[app:tutorial]
use = egg:tutorial
reload_templates = true
debug_authorization = false
debug_notfound = false
Expand All @@ -13,7 +10,7 @@ pipeline =
egg:repoze.zodbconn#closer
egg:Paste#evalerror
egg:repoze.tm#tm
zodb
tutorial

[server:main]
use = egg:Paste#http
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/wiki/src/authorization/setup.py
Expand Up @@ -12,6 +12,7 @@
'ZODB3',
'repoze.zodbconn',
'repoze.tm',
'WebError',
]

setup(name='tutorial',
Expand All @@ -28,7 +29,7 @@
author='',
author_email='',
url='',
keywords='web wsgi pylons pyramid bfg',
keywords='web pylons pyramid',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
Expand All @@ -37,7 +38,7 @@
test_suite="tutorial",
entry_points = """\
[paste.app_factory]
app = tutorial:app
main = tutorial:main
"""
)

4 changes: 2 additions & 2 deletions docs/tutorials/wiki/src/authorization/tutorial/__init__.py
@@ -1,9 +1,8 @@
from pyramid.configuration import Configurator
from repoze.zodbconn.finder import PersistentApplicationFinder

from tutorial.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
Expand All @@ -12,6 +11,7 @@ def app(global_config, **settings):
zodb_uri = settings.get('zodb_uri')
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)
Expand Down
9 changes: 3 additions & 6 deletions docs/tutorials/wiki/src/basiclayout/development.ini
@@ -1,8 +1,5 @@
[DEFAULT]
debug = true

[app:zodb]
use = egg:tutorial#app
[app:tutorial]
use = egg:tutorial
reload_templates = true
debug_authorization = false
debug_notfound = false
Expand All @@ -12,7 +9,7 @@ zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
pipeline =
egg:repoze.zodbconn#closer
egg:repoze.tm#tm
zodb
tutorial

[server:main]
use = egg:Paste#http
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/wiki/src/basiclayout/setup.py
Expand Up @@ -12,6 +12,7 @@
'ZODB3',
'repoze.zodbconn',
'repoze.tm',
'WebError',
]

setup(name='tutorial',
Expand All @@ -28,7 +29,7 @@
author='',
author_email='',
url='',
keywords='web wsgi pylons pyramid bfg',
keywords='web pyramid bfg',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
Expand All @@ -37,6 +38,6 @@
test_suite="tutorial",
entry_points = """\
[paste.app_factory]
app = tutorial:app
main = tutorial:main
"""
)
9 changes: 3 additions & 6 deletions docs/tutorials/wiki/src/basiclayout/tutorial/__init__.py
@@ -1,17 +1,14 @@
from pyramid.configuration import Configurator
from repoze.zodbconn.finder import PersistentApplicationFinder

from tutorial.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``.
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
zodb_uri = settings.get('zodb_uri')
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)
Expand Down
9 changes: 3 additions & 6 deletions docs/tutorials/wiki/src/models/development.ini
@@ -1,8 +1,5 @@
[DEFAULT]
debug = true

[app:zodb]
use = egg:tutorial#app
[app:tutorial]
use = egg:tutorial
reload_templates = true
debug_authorization = false
debug_notfound = false
Expand All @@ -12,7 +9,7 @@ zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
pipeline =
egg:repoze.zodbconn#closer
egg:repoze.tm#tm
zodb
tutorial

[server:main]
use = egg:Paste#http
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/wiki/src/models/setup.py
Expand Up @@ -12,6 +12,7 @@
'ZODB3',
'repoze.zodbconn',
'repoze.tm',
'WebError',
]

setup(name='tutorial',
Expand All @@ -28,7 +29,7 @@
author='',
author_email='',
url='',
keywords='web wsgi pylons pyramid bfg',
keywords='web pylons pyramid',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
Expand All @@ -37,6 +38,6 @@
test_suite="tutorial",
entry_points = """\
[paste.app_factory]
app = tutorial:app
main = tutorial:main
"""
)
4 changes: 2 additions & 2 deletions docs/tutorials/wiki/src/models/tutorial/__init__.py
@@ -1,9 +1,8 @@
from pyramid.configuration import Configurator
from repoze.zodbconn.finder import PersistentApplicationFinder

from tutorial.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
Expand All @@ -12,6 +11,7 @@ def app(global_config, **settings):
zodb_uri = settings.get('zodb_uri')
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)
Expand Down
9 changes: 3 additions & 6 deletions docs/tutorials/wiki/src/viewdecorators/development.ini
@@ -1,8 +1,5 @@
[DEFAULT]
debug = true

[app:zodb]
use = egg:tutorial#app
[app:tutorial]
use = egg:tutorial
reload_templates = true
debug_authorization = false
debug_notfound = false
Expand All @@ -13,7 +10,7 @@ pipeline =
egg:repoze.zodbconn#closer
egg:Paste#evalerror
egg:repoze.tm#tm
zodb
tutorial

[server:main]
use = egg:Paste#http
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/wiki/src/viewdecorators/setup.py
Expand Up @@ -12,6 +12,7 @@
'ZODB3',
'repoze.zodbconn',
'repoze.tm',
'WebError',
]

setup(name='tutorial',
Expand All @@ -28,7 +29,7 @@
author='',
author_email='',
url='',
keywords='web wsgi bfg pylons pyramid',
keywords='web pylons pyramid',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
Expand All @@ -37,6 +38,6 @@
test_suite="tutorial",
entry_points = """\
[paste.app_factory]
app = tutorial:app
main = tutorial:main
"""
)
4 changes: 2 additions & 2 deletions docs/tutorials/wiki/src/viewdecorators/tutorial/__init__.py
@@ -1,9 +1,8 @@
from pyramid.configuration import Configurator
from repoze.zodbconn.finder import PersistentApplicationFinder

from tutorial.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
Expand All @@ -12,6 +11,7 @@ def app(global_config, **settings):
zodb_uri = settings.get('zodb_uri')
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)
Expand Down
9 changes: 3 additions & 6 deletions docs/tutorials/wiki/src/views/development.ini
@@ -1,8 +1,5 @@
[DEFAULT]
debug = true

[app:zodb]
use = egg:tutorial#app
[app:tutorial]
use = egg:tutorial
reload_templates = true
debug_authorization = false
debug_notfound = false
Expand All @@ -13,7 +10,7 @@ pipeline =
egg:repoze.zodbconn#closer
egg:Paste#evalerror
egg:repoze.tm#tm
zodb
tutorial

[server:main]
use = egg:Paste#http
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/wiki/src/views/setup.py
Expand Up @@ -12,6 +12,7 @@
'ZODB3',
'repoze.zodbconn',
'repoze.tm',
'WebError',
]

setup(name='tutorial',
Expand All @@ -28,7 +29,7 @@
author='',
author_email='',
url='',
keywords='web wsgi pylons pyramid bfg',
keywords='web pylons pyramid',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
Expand All @@ -37,6 +38,6 @@
test_suite="tutorial",
entry_points = """\
[paste.app_factory]
app = tutorial:app
main = tutorial:main
"""
)
4 changes: 2 additions & 2 deletions docs/tutorials/wiki/src/views/tutorial/__init__.py
@@ -1,9 +1,8 @@
from pyramid.configuration import Configurator
from repoze.zodbconn.finder import PersistentApplicationFinder

from tutorial.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
Expand All @@ -12,6 +11,7 @@ def app(global_config, **settings):
zodb_uri = settings.get('zodb_uri')
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)
Expand Down
2 changes: 1 addition & 1 deletion pyramid/paster_templates/zodb/+package+/__init__.py_tmpl
Expand Up @@ -3,7 +3,7 @@ from repoze.zodbconn.finder import PersistentApplicationFinder
from {{package}}.models import appmaker

def main(global_config, **settings):
""" This function returns a WSGI application.
""" This function returns a Pyramid WSGI application.
"""
zodb_uri = settings.get('zodb_uri')
zcml_file = settings.get('configure_zcml', 'configure.zcml')
Expand Down

0 comments on commit c44c409

Please sign in to comment.