diff options
| author | Chris McDonough <chrism@plope.com> | 2013-02-09 19:15:07 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-02-09 19:15:07 -0500 |
| commit | acf115391088770ae434d222179fd22a693bfe46 (patch) | |
| tree | 442d33920cd6d20ccb7ce3cff3344fd851448d0d /docs/tutorials/wiki/src/views | |
| parent | 6313e0dd97e22b8c897293cd8d5f2f145637f49f (diff) | |
| parent | 7fe736bf57696aa62c8b0d84e62ad486d0f88f40 (diff) | |
| download | pyramid-acf115391088770ae434d222179fd22a693bfe46.tar.gz pyramid-acf115391088770ae434d222179fd22a693bfe46.tar.bz2 pyramid-acf115391088770ae434d222179fd22a693bfe46.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/tutorials/wiki/src/views')
| -rw-r--r-- | docs/tutorials/wiki/src/views/development.ini | 30 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/views/production.ini | 17 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/views/setup.py | 8 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/views/tutorial/__init__.py | 8 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt | 6 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/views/tutorial/tests.py | 27 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/views/tutorial/views.py | 4 |
7 files changed, 67 insertions, 33 deletions
diff --git a/docs/tutorials/wiki/src/views/development.ini b/docs/tutorials/wiki/src/views/development.ini index f637ebaa6..72bd22e54 100644 --- a/docs/tutorials/wiki/src/views/development.ini +++ b/docs/tutorials/wiki/src/views/development.ini @@ -1,5 +1,11 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial + pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false @@ -13,15 +19,26 @@ pyramid.includes = tm.attempts = 3 zodbconn.uri = file://%(here)s/Data.fs?connection_cache_size=20000 +# By default, the toolbar only appears for clients from IP addresses +# '127.0.0.1' and '::1'. +# debugtoolbar.hosts = 127.0.0.1 ::1 + +### +# wsgi server configuration +### + [server:main] use = egg:waitress#main host = 0.0.0.0 port = 6543 -# Begin logging configuration +### +# logging configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html +### [loggers] -keys = root +keys = root, tutorial [handlers] keys = console @@ -33,6 +50,11 @@ keys = generic level = INFO handlers = console +[logger_tutorial] +level = DEBUG +handlers = +qualname = tutorial + [handler_console] class = StreamHandler args = (sys.stderr,) @@ -40,6 +62,4 @@ level = NOTSET formatter = generic [formatter_generic] -format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s - -# End logging configuration +format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s diff --git a/docs/tutorials/wiki/src/views/production.ini b/docs/tutorials/wiki/src/views/production.ini index ca8107802..d9bf27c42 100644 --- a/docs/tutorials/wiki/src/views/production.ini +++ b/docs/tutorials/wiki/src/views/production.ini @@ -1,5 +1,11 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial + pyramid.reload_templates = false pyramid.debug_authorization = false pyramid.debug_notfound = false @@ -12,12 +18,19 @@ pyramid.includes = tm.attempts = 3 zodbconn.uri = file://%(here)s/Data.fs?connection_cache_size=20000 +### +# wsgi server configuration +### + [server:main] use = egg:waitress#main host = 0.0.0.0 port = 6543 -# Begin logging configuration +### +# logging configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html +### [loggers] keys = root, tutorial @@ -45,5 +58,3 @@ formatter = generic [formatter_generic] format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s - -# End logging configuration diff --git a/docs/tutorials/wiki/src/views/setup.py b/docs/tutorials/wiki/src/views/setup.py index a6be89b2e..3164fd724 100644 --- a/docs/tutorials/wiki/src/views/setup.py +++ b/docs/tutorials/wiki/src/views/setup.py @@ -9,6 +9,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'pyramid_zodbconn', + 'transaction', 'pyramid_tm', 'pyramid_debugtoolbar', 'ZODB3', @@ -19,11 +20,10 @@ requires = [ setup(name='tutorial', version='0.0', description='tutorial', - long_description=README + '\n\n' + CHANGES, + long_description=README + '\n\n' + CHANGES, classifiers=[ - "Intended Audience :: Developers", - "Framework :: Pylons", "Programming Language :: Python", + "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], @@ -37,7 +37,7 @@ setup(name='tutorial', install_requires=requires, tests_require=requires, test_suite="tutorial", - entry_points = """\ + entry_points="""\ [paste.app_factory] main = tutorial:main """, diff --git a/docs/tutorials/wiki/src/views/tutorial/__init__.py b/docs/tutorials/wiki/src/views/tutorial/__init__.py index 957a0b705..c3bb87a62 100644 --- a/docs/tutorials/wiki/src/views/tutorial/__init__.py +++ b/docs/tutorials/wiki/src/views/tutorial/__init__.py @@ -1,15 +1,17 @@ from pyramid.config import Configurator from pyramid_zodbconn import get_connection -from tutorial.models import appmaker +from .models import appmaker + def root_factory(request): conn = get_connection(request) return appmaker(conn.root()) + def main(global_config, **settings): - """ This function returns a WSGI application. + """ This function returns a Pyramid WSGI application. """ config = Configurator(root_factory=root_factory, settings=settings) config.add_static_view('static', 'static', cache_max_age=3600) - config.scan('tutorial') + config.scan() return config.make_wsgi_app() diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt index 3597c679b..84824f605 100644 --- a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt +++ b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt @@ -6,9 +6,9 @@ <meta name="keywords" content="python web application" /> <meta name="description" content="pyramid web application" /> <link rel="shortcut icon" href="/static/favicon.ico" /> + <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" /> <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" /> - <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" /> <!--[if lte IE 6]> <link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" /> <![endif]--> @@ -41,7 +41,7 @@ <h2>Pyramid links</h2> <ul class="links"> <li> - <a href="http://pylonsproject.org">Pylons Website</a> + <a href="http://pylonsproject.org/">Pylons Website</a> </li> <li> <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a> @@ -70,7 +70,7 @@ </div> </div> <div id="footer"> - <div class="footer">© Copyright 2008-2011, Agendaless Consulting.</div> + <div class="footer">© Copyright 2008-2012, Agendaless Consulting.</div> </div> </body> </html> diff --git a/docs/tutorials/wiki/src/views/tutorial/tests.py b/docs/tutorials/wiki/src/views/tutorial/tests.py index 9eac2a432..663c9f405 100644 --- a/docs/tutorials/wiki/src/views/tutorial/tests.py +++ b/docs/tutorials/wiki/src/views/tutorial/tests.py @@ -5,7 +5,7 @@ from pyramid import testing class PageModelTests(unittest.TestCase): def _getTargetClass(self): - from tutorial.models import Page + from .models import Page return Page def _makeOne(self, data=u'some data'): @@ -14,11 +14,11 @@ class PageModelTests(unittest.TestCase): def test_constructor(self): instance = self._makeOne() self.assertEqual(instance.data, u'some data') - + class WikiModelTests(unittest.TestCase): def _getTargetClass(self): - from tutorial.models import Wiki + from .models import Wiki return Wiki def _makeOne(self): @@ -30,8 +30,9 @@ class WikiModelTests(unittest.TestCase): self.assertEqual(wiki.__name__, None) class AppmakerTests(unittest.TestCase): + def _callFUT(self, zodb_root): - from tutorial.models import appmaker + from .models import appmaker return appmaker(zodb_root) def test_it(self): @@ -42,7 +43,7 @@ class AppmakerTests(unittest.TestCase): class ViewWikiTests(unittest.TestCase): def test_it(self): - from tutorial.views import view_wiki + from .views import view_wiki context = testing.DummyResource() request = testing.DummyRequest() response = view_wiki(context, request) @@ -50,7 +51,7 @@ class ViewWikiTests(unittest.TestCase): class ViewPageTests(unittest.TestCase): def _callFUT(self, context, request): - from tutorial.views import view_page + from .views import view_page return view_page(context, request) def test_it(self): @@ -63,7 +64,7 @@ class ViewPageTests(unittest.TestCase): info = self._callFUT(context, request) self.assertEqual(info['page'], context) self.assertEqual( - info['content'], + info['content'], '<div class="document">\n' '<p>Hello <a href="http://example.com/add_page/CruelWorld">' 'CruelWorld</a> ' @@ -72,11 +73,11 @@ class ViewPageTests(unittest.TestCase): '</p>\n</div>\n') self.assertEqual(info['edit_url'], 'http://example.com/thepage/edit_page') - - + + class AddPageTests(unittest.TestCase): def _callFUT(self, context, request): - from tutorial.views import add_page + from .views import add_page return add_page(context, request) def test_it_notsubmitted(self): @@ -88,7 +89,7 @@ class AddPageTests(unittest.TestCase): self.assertEqual( info['save_url'], request.resource_url(context, 'add_page', 'AnotherPage')) - + def test_it_submitted(self): context = testing.DummyResource() request = testing.DummyRequest({'form.submitted':True, @@ -102,7 +103,7 @@ class AddPageTests(unittest.TestCase): class EditPageTests(unittest.TestCase): def _callFUT(self, context, request): - from tutorial.views import edit_page + from .views import edit_page return edit_page(context, request) def test_it_notsubmitted(self): @@ -112,7 +113,7 @@ class EditPageTests(unittest.TestCase): self.assertEqual(info['page'], context) self.assertEqual(info['save_url'], request.resource_url(context, 'edit_page')) - + def test_it_submitted(self): context = testing.DummyResource() request = testing.DummyRequest({'form.submitted':True, diff --git a/docs/tutorials/wiki/src/views/tutorial/views.py b/docs/tutorials/wiki/src/views/tutorial/views.py index b0c15297f..61517c31d 100644 --- a/docs/tutorials/wiki/src/views/tutorial/views.py +++ b/docs/tutorials/wiki/src/views/tutorial/views.py @@ -56,5 +56,5 @@ def edit_page(context, request): context.data = request.params['body'] return HTTPFound(location = request.resource_url(context)) - return dict(page = context, - save_url = request.resource_url(context, 'edit_page')) + return dict(page=context, + save_url=request.resource_url(context, 'edit_page')) |
