summaryrefslogtreecommitdiff
path: root/docs/narr/MyProject
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-12-18 15:53:49 -0500
committerChris McDonough <chrism@plope.com>2010-12-18 15:53:49 -0500
commit738a2b5f3eb44da7036a31005144e5252827ac38 (patch)
tree80e10d2ae215b2e0e1f248354b6c9a5e11406cd5 /docs/narr/MyProject
parentaa6c4267b330a5665dcb7c98d75fe21f8eeececb (diff)
parent70119302324e5bf5627344f90c62ef31b6e43005 (diff)
downloadpyramid-738a2b5f3eb44da7036a31005144e5252827ac38.tar.gz
pyramid-738a2b5f3eb44da7036a31005144e5252827ac38.tar.bz2
pyramid-738a2b5f3eb44da7036a31005144e5252827ac38.zip
Merge branch 'model2resource'
Conflicts: docs/narr/views.rst
Diffstat (limited to 'docs/narr/MyProject')
-rw-r--r--docs/narr/MyProject/myproject/__init__.py6
-rw-r--r--docs/narr/MyProject/myproject/models.py7
-rw-r--r--docs/narr/MyProject/myproject/resources.py3
3 files changed, 6 insertions, 10 deletions
diff --git a/docs/narr/MyProject/myproject/__init__.py b/docs/narr/MyProject/myproject/__init__.py
index 05730a115..813028704 100644
--- a/docs/narr/MyProject/myproject/__init__.py
+++ b/docs/narr/MyProject/myproject/__init__.py
@@ -1,12 +1,12 @@
from pyramid.config import Configurator
-from myproject.models import get_root
+from myproject.resources import Root
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
- config = Configurator(root_factory=get_root, settings=settings)
+ config = Configurator(root_factory=Root, settings=settings)
config.add_view('myproject.views.my_view',
- context='myproject.models.MyModel',
+ context='myproject.resources.Root',
renderer='myproject:templates/mytemplate.pt')
config.add_static_view('static', 'myproject:static')
return config.make_wsgi_app()
diff --git a/docs/narr/MyProject/myproject/models.py b/docs/narr/MyProject/myproject/models.py
deleted file mode 100644
index 75dec7505..000000000
--- a/docs/narr/MyProject/myproject/models.py
+++ /dev/null
@@ -1,7 +0,0 @@
-class MyModel(object):
- pass
-
-root = MyModel()
-
-def get_root(request):
- return root
diff --git a/docs/narr/MyProject/myproject/resources.py b/docs/narr/MyProject/myproject/resources.py
new file mode 100644
index 000000000..3d811895c
--- /dev/null
+++ b/docs/narr/MyProject/myproject/resources.py
@@ -0,0 +1,3 @@
+class Root(object):
+ def __init__(self, request):
+ self.request = request