From 49fb779f52748df05c911263d1305cda3e86a5ec Mon Sep 17 00:00:00 2001 From: John Anderson Date: Mon, 5 Nov 2012 00:50:21 -0300 Subject: added the ability to pass options to get_app for use with string interpolation in the config --- pyramid/paster.py | 17 ++++++++--- pyramid/scripts/__init__.py | 1 - pyramid/scripts/common.py | 15 ++++++++++ pyramid/scripts/prequest.py | 5 +++- pyramid/scripts/proutes.py | 5 +++- pyramid/scripts/pserve.py | 46 ++++++++++++++--------------- pyramid/scripts/pshell.py | 4 ++- pyramid/scripts/ptweens.py | 3 +- pyramid/scripts/pviews.py | 7 +++-- pyramid/tests/test_paster.py | 2 +- pyramid/tests/test_scripts/test_common.py | 13 ++++++++ pyramid/tests/test_scripts/test_prequest.py | 4 ++- pyramid/tests/test_scripts/test_proutes.py | 19 ++++++++++++ pyramid/tests/test_scripts/test_pserve.py | 43 ++++++++++++++++++++++----- 14 files changed, 140 insertions(+), 44 deletions(-) diff --git a/pyramid/paster.py b/pyramid/paster.py index b0e4d7933..b1a6d4c8b 100644 --- a/pyramid/paster.py +++ b/pyramid/paster.py @@ -9,17 +9,26 @@ from pyramid.compat import configparser from logging.config import fileConfig from pyramid.scripting import prepare -def get_app(config_uri, name=None, loadapp=loadapp): +def get_app(config_uri, name=None, options={}, loadapp=loadapp): """ Return the WSGI application named ``name`` in the PasteDeploy config file specified by ``config_uri``. + ``options`` are used as variable assignments like {'http_port': 8080} + and then use %(http_port)s in the config file. + If the ``name`` is None, this will attempt to parse the name from the ``config_uri`` string expecting the format ``inifile#name``. If no name is found, the name will default to "main".""" path, section = _getpathsec(config_uri, name) config_name = 'config:%s' % path here_dir = os.getcwd() - app = loadapp(config_name, name=section, relative_to=here_dir) + if options: + kw = {'global_conf': options} + else: + kw = {} + + app = loadapp(config_name, name=section, relative_to=here_dir, **kw) + return app def get_appsettings(config_uri, name=None, appconfig=appconfig): @@ -63,7 +72,7 @@ def _getpathsec(config_uri, name): section = name return path, section -def bootstrap(config_uri, request=None): +def bootstrap(config_uri, request=None, options={}): """ Load a WSGI application from the PasteDeploy config file specified by ``config_uri``. The environment will be configured as if it is currently serving ``request``, leaving a natural environment in place @@ -106,7 +115,7 @@ def bootstrap(config_uri, request=None): See :ref:`writing_a_script` for more information about how to use this function. """ - app = get_app(config_uri) + app = get_app(config_uri, options=options) env = prepare(request) env['app'] = app return env diff --git a/pyramid/scripts/__init__.py b/pyramid/scripts/__init__.py index ed88d78b4..5bb534f79 100644 --- a/pyramid/scripts/__init__.py +++ b/pyramid/scripts/__init__.py @@ -1,2 +1 @@ # package - diff --git a/pyramid/scripts/common.py b/pyramid/scripts/common.py index dfff26449..cbc172e9b 100644 --- a/pyramid/scripts/common.py +++ b/pyramid/scripts/common.py @@ -2,6 +2,21 @@ import os from pyramid.compat import configparser from logging.config import fileConfig +def parse_vars(args): + """ + Given variables like ``['a=b', 'c=d']`` turns it into ``{'a': + 'b', 'c': 'd'}`` + """ + result = {} + for arg in args: + if '=' not in arg: + raise ValueError( + 'Variable assignment %r invalid (no "=")' + % arg) + name, value = arg.split('=', 1) + result[name] = value + return result + def logging_file_config(config_file, fileConfig=fileConfig, configparser=configparser): """ diff --git a/pyramid/scripts/prequest.py b/pyramid/scripts/prequest.py index 13406372a..da6b8cc14 100644 --- a/pyramid/scripts/prequest.py +++ b/pyramid/scripts/prequest.py @@ -5,6 +5,7 @@ import textwrap from pyramid.compat import url_unquote from pyramid.request import Request from pyramid.paster import get_app +from pyramid.scripts.common import parse_vars def main(argv=sys.argv, quiet=False): command = PRequestCommand(argv, quiet) @@ -101,7 +102,9 @@ class PRequestCommand(object): name, value = item.split(':', 1) headers[name] = value.strip() - app = self.get_app(app_spec, self.options.app_name) + app = self.get_app(app_spec, self.options.app_name, + options=parse_vars(self.args[2:])) + request_method = (self.options.method or 'GET').upper() environ = { diff --git a/pyramid/scripts/proutes.py b/pyramid/scripts/proutes.py index f64107d2b..49e19deca 100644 --- a/pyramid/scripts/proutes.py +++ b/pyramid/scripts/proutes.py @@ -3,6 +3,7 @@ import sys import textwrap from pyramid.paster import bootstrap +from pyramid.scripts.common import parse_vars def main(argv=sys.argv, quiet=False): command = PRoutesCommand(argv, quiet) @@ -47,12 +48,14 @@ class PRoutesCommand(object): if not self.args: self.out('requires a config file argument') return 2 + from pyramid.interfaces import IRouteRequest from pyramid.interfaces import IViewClassifier from pyramid.interfaces import IView from zope.interface import Interface config_uri = self.args[0] - env = self.bootstrap[0](config_uri) + + env = self.bootstrap[0](config_uri, options=parse_vars(self.args[1:])) registry = env['registry'] mapper = self._get_mapper(registry) if mapper is not None: diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py index 9fbf0729a..44ee54dcd 100644 --- a/pyramid/scripts/pserve.py +++ b/pyramid/scripts/pserve.py @@ -22,12 +22,15 @@ import threading import time import traceback -from paste.deploy import loadapp, loadserver +from paste.deploy import loadserver +from paste.deploy import loadapp from pyramid.compat import WIN from pyramid.paster import setup_logging +from pyramid.scripts.common import parse_vars + MAXFD = 1024 if WIN and not hasattr(os, 'kill'): # pragma: no cover @@ -160,6 +163,15 @@ class PServeCommand(object): if not self.quiet: print(msg) + def get_options(self): + if (len(self.args) > 1 + and self.args[1] in self.possible_subcommands): + restvars = self.args[2:] + else: + restvars = self.args[1:] + + return parse_vars(restvars) + def run(self): # pragma: no cover if self.options.stop_daemon: return self.stop_daemon() @@ -179,10 +191,8 @@ class PServeCommand(object): if (len(self.args) > 1 and self.args[1] in self.possible_subcommands): cmd = self.args[1] - restvars = self.args[2:] else: cmd = None - restvars = self.args[1:] if self.options.reload: if os.environ.get(self._reloader_environ_key): @@ -218,7 +228,9 @@ class PServeCommand(object): self.options.daemon = True app_name = self.options.app_name - vars = self.parse_vars(restvars) + + vars = self.get_options() + if not self._scheme_re.search(app_spec): app_spec = 'config:' + app_spec server_name = self.options.server_name @@ -286,8 +298,9 @@ class PServeCommand(object): server = self.loadserver(server_spec, name=server_name, relative_to=base, global_conf=vars) - app = self.loadapp(app_spec, name=app_name, - relative_to=base, global_conf=vars) + + app = self.loadapp(app_spec, name=app_name, relative_to=base, + global_conf=vars) if self.verbose > 0: if hasattr(os, 'getpid'): @@ -310,27 +323,12 @@ class PServeCommand(object): serve() - def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover - return loadserver( - server_spec, name=name, relative_to=relative_to, **kw) - def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover return loadapp(app_spec, name=name, relative_to=relative_to, **kw) - def parse_vars(self, args): - """ - Given variables like ``['a=b', 'c=d']`` turns it into ``{'a': - 'b', 'c': 'd'}`` - """ - result = {} - for arg in args: - if '=' not in arg: - raise ValueError( - 'Variable assignment %r invalid (no "=")' - % arg) - name, value = arg.split('=', 1) - result[name] = value - return result + def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover + return loadserver( + server_spec, name=name, relative_to=relative_to, **kw) def quote_first_command_arg(self, arg): # pragma: no cover """ diff --git a/pyramid/scripts/pshell.py b/pyramid/scripts/pshell.py index 7a21eaf98..f74402928 100644 --- a/pyramid/scripts/pshell.py +++ b/pyramid/scripts/pshell.py @@ -9,6 +9,8 @@ from pyramid.paster import bootstrap from pyramid.paster import setup_logging +from pyramid.scripts.common import parse_vars + def main(argv=sys.argv, quiet=False): command = PShellCommand(argv, quiet) return command.run() @@ -87,7 +89,7 @@ class PShellCommand(object): self.pshell_file_config(config_file) # bootstrap the environ - env = self.bootstrap[0](config_uri) + env = self.bootstrap[0](config_uri, options=parse_vars(self.args[1:])) # remove the closer from the env closer = env.pop('closer') diff --git a/pyramid/scripts/ptweens.py b/pyramid/scripts/ptweens.py index d3e17db58..5fe2fa120 100644 --- a/pyramid/scripts/ptweens.py +++ b/pyramid/scripts/ptweens.py @@ -7,6 +7,7 @@ from pyramid.interfaces import ITweens from pyramid.tweens import MAIN from pyramid.tweens import INGRESS from pyramid.paster import bootstrap +from pyramid.scripts.common import parse_vars def main(argv=sys.argv, quiet=False): command = PTweensCommand(argv, quiet) @@ -62,7 +63,7 @@ class PTweensCommand(object): self.out('Requires a config file argument') return 2 config_uri = self.args[0] - env = self.bootstrap[0](config_uri) + env = self.bootstrap[0](config_uri, options=parse_vars(self.args[1:])) registry = env['registry'] tweens = self._get_tweens(registry) if tweens is not None: diff --git a/pyramid/scripts/pviews.py b/pyramid/scripts/pviews.py index a9db59dc1..1bb4f2227 100644 --- a/pyramid/scripts/pviews.py +++ b/pyramid/scripts/pviews.py @@ -4,6 +4,7 @@ import textwrap from pyramid.interfaces import IMultiView from pyramid.paster import bootstrap +from pyramid.scripts.common import parse_vars def main(argv=sys.argv, quiet=False): command = PViewsCommand(argv, quiet) @@ -230,10 +231,12 @@ class PViewsCommand(object): if len(self.args) < 2: self.out('Command requires a config file arg and a url arg') return 2 - config_uri, url = self.args + config_uri = self.args[0] + url = self.args[1] + if not url.startswith('/'): url = '/%s' % url - env = self.bootstrap[0](config_uri) + env = self.bootstrap[0](config_uri, options=parse_vars(self.args[2:])) registry = env['registry'] view = self._find_view(url, registry) self.out('') diff --git a/pyramid/tests/test_paster.py b/pyramid/tests/test_paster.py index d94b46a9f..47643e972 100644 --- a/pyramid/tests/test_paster.py +++ b/pyramid/tests/test_paster.py @@ -4,7 +4,7 @@ import unittest class Test_get_app(unittest.TestCase): def _callFUT(self, config_file, section_name, loadapp): from pyramid.paster import get_app - return get_app(config_file, section_name, loadapp) + return get_app(config_file, section_name, loadapp=loadapp) def test_it(self): app = DummyApp() diff --git a/pyramid/tests/test_scripts/test_common.py b/pyramid/tests/test_scripts/test_common.py index c3c792ca4..13ab0ae6a 100644 --- a/pyramid/tests/test_scripts/test_common.py +++ b/pyramid/tests/test_scripts/test_common.py @@ -17,6 +17,19 @@ class Test_logging_file_config(unittest.TestCase): def fileConfig(self, config_file, dict): return config_file, dict +class TestParseVars(unittest.TestCase): + def test_parse_vars_good(self): + from pyramid.scripts.common import parse_vars + vars = ['a=1', 'b=2'] + result = parse_vars(vars) + self.assertEqual(result, {'a': '1', 'b': '2'}) + + def test_parse_vars_bad(self): + from pyramid.scripts.common import parse_vars + vars = ['a'] + self.assertRaises(ValueError, parse_vars, vars) + + class DummyConfigParser(object): def read(self, x): pass diff --git a/pyramid/tests/test_scripts/test_prequest.py b/pyramid/tests/test_scripts/test_prequest.py index cf7af4218..76cb35881 100644 --- a/pyramid/tests/test_scripts/test_prequest.py +++ b/pyramid/tests/test_scripts/test_prequest.py @@ -13,9 +13,11 @@ class TestPRequestCommand(unittest.TestCase): cmd.out = self.out return cmd - def get_app(self, spec, app_name=None): + def get_app(self, spec, app_name=None, options={}): self._spec = spec self._app_name = app_name + self._options = options + def helloworld(environ, start_request): self._environ = environ self._path_info = environ['PATH_INFO'] diff --git a/pyramid/tests/test_scripts/test_proutes.py b/pyramid/tests/test_scripts/test_proutes.py index fad8c1895..0b95729a6 100644 --- a/pyramid/tests/test_scripts/test_proutes.py +++ b/pyramid/tests/test_scripts/test_proutes.py @@ -12,6 +12,25 @@ class TestPRoutesCommand(unittest.TestCase): cmd.args = ('/foo/bar/myapp.ini#myapp',) return cmd + def test_good_args(self): + cmd = self._getTargetClass()([]) + cmd.bootstrap = (dummy.DummyBootstrap(),) + cmd.args = ('/foo/bar/myapp.ini#myapp', 'a=1') + route = dummy.DummyRoute('a', '/a') + mapper = dummy.DummyMapper(route) + cmd._get_mapper = lambda *arg: mapper + cmd.run() + + def test_bad_args(self): + cmd = self._getTargetClass()([]) + cmd.bootstrap = (dummy.DummyBootstrap(),) + cmd.args = ('/foo/bar/myapp.ini#myapp', 'a') + route = dummy.DummyRoute('a', '/a') + mapper = dummy.DummyMapper(route) + cmd._get_mapper = lambda *arg: mapper + + self.assertRaises(ValueError, cmd.run) + def test_no_routes(self): command = self._makeOne() mapper = dummy.DummyMapper() diff --git a/pyramid/tests/test_scripts/test_pserve.py b/pyramid/tests/test_scripts/test_pserve.py index d7b252d92..18ba3a779 100644 --- a/pyramid/tests/test_scripts/test_pserve.py +++ b/pyramid/tests/test_scripts/test_pserve.py @@ -22,6 +22,12 @@ class TestPServeCommand(unittest.TestCase): def out(self, msg): self.out_.write(msg) + def _get_server(*args, **kwargs): + def server(app): + return '' + + return server + def _getTargetClass(self): from pyramid.scripts.pserve import PServeCommand return PServeCommand @@ -194,15 +200,38 @@ class TestPServeCommand(unittest.TestCase): self.assertEqual(self.out_.getvalue(), msg) def test_parse_vars_good(self): - vars = ['a=1', 'b=2'] - inst = self._makeOne('development.ini') - result = inst.parse_vars(vars) - self.assertEqual(result, {'a': '1', 'b': '2'}) + from pyramid.tests.test_scripts.dummy import DummyApp + + inst = self._makeOne('development.ini', 'a=1', 'b=2') + inst.loadserver = self._get_server + + + app = DummyApp() + + def get_app(*args, **kwargs): + app.global_conf = kwargs.get('global_conf', None) + + inst.loadapp = get_app + inst.run() + + self.assertEqual(app.global_conf, {'a': '1', 'b': '2'}) def test_parse_vars_bad(self): - vars = ['a'] - inst = self._makeOne('development.ini') - self.assertRaises(ValueError, inst.parse_vars, vars) + from pyramid.tests.test_scripts.dummy import DummyApp + + inst = self._makeOne('development.ini', 'a') + + inst.loadserver = self._get_server + + + app = DummyApp() + + def get_app(*args, **kwargs): + app.global_conf = kwargs.get('global_conf', None) + + inst.loadapp = get_app + + self.assertRaises(ValueError, inst.run) class Test_read_pidfile(unittest.TestCase): def _callFUT(self, filename): -- cgit v1.2.3 From bb20ecd8309ed2ce6fd0095fadc0d0bf5d0bf07d Mon Sep 17 00:00:00 2001 From: ericrasmussen Date: Mon, 5 Nov 2012 16:58:08 -0800 Subject: add transaction dependency to zodb scaffold --- pyramid/scaffolds/zodb/setup.py_tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/pyramid/scaffolds/zodb/setup.py_tmpl b/pyramid/scaffolds/zodb/setup.py_tmpl index acdf095d5..df239f5a7 100644 --- a/pyramid/scaffolds/zodb/setup.py_tmpl +++ b/pyramid/scaffolds/zodb/setup.py_tmpl @@ -9,6 +9,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'pyramid_zodbconn', + 'transaction', 'pyramid_tm', 'pyramid_debugtoolbar', 'ZODB3', -- cgit v1.2.3 From 60ed104358863c58166fe79bce06bec9d6b61c21 Mon Sep 17 00:00:00 2001 From: ericrasmussen Date: Mon, 5 Nov 2012 17:31:10 -0800 Subject: adding transaction module requirement to zodb wiki docs --- docs/tutorials/wiki/src/authorization/setup.py | 1 + docs/tutorials/wiki/src/basiclayout/setup.py | 1 + docs/tutorials/wiki/src/models/setup.py | 1 + docs/tutorials/wiki/src/tests/setup.py | 1 + docs/tutorials/wiki/src/views/setup.py | 1 + 5 files changed, 5 insertions(+) diff --git a/docs/tutorials/wiki/src/authorization/setup.py b/docs/tutorials/wiki/src/authorization/setup.py index 31c51dbcf..d83f14400 100644 --- a/docs/tutorials/wiki/src/authorization/setup.py +++ b/docs/tutorials/wiki/src/authorization/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', diff --git a/docs/tutorials/wiki/src/basiclayout/setup.py b/docs/tutorials/wiki/src/basiclayout/setup.py index 43600e239..bd26f8efc 100644 --- a/docs/tutorials/wiki/src/basiclayout/setup.py +++ b/docs/tutorials/wiki/src/basiclayout/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', diff --git a/docs/tutorials/wiki/src/models/setup.py b/docs/tutorials/wiki/src/models/setup.py index 43600e239..bd26f8efc 100644 --- a/docs/tutorials/wiki/src/models/setup.py +++ b/docs/tutorials/wiki/src/models/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', diff --git a/docs/tutorials/wiki/src/tests/setup.py b/docs/tutorials/wiki/src/tests/setup.py index a7ad7317c..51c638638 100644 --- a/docs/tutorials/wiki/src/tests/setup.py +++ b/docs/tutorials/wiki/src/tests/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', diff --git a/docs/tutorials/wiki/src/views/setup.py b/docs/tutorials/wiki/src/views/setup.py index a6be89b2e..6f946582c 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', -- cgit v1.2.3 From c495e90e8d197ff5d9242bd2368d7579d993bd51 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 14 Nov 2012 01:28:57 -0500 Subject: make an assertion in this test --- pyramid/tests/test_scripts/test_proutes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyramid/tests/test_scripts/test_proutes.py b/pyramid/tests/test_scripts/test_proutes.py index 0b95729a6..25a3cd2e3 100644 --- a/pyramid/tests/test_scripts/test_proutes.py +++ b/pyramid/tests/test_scripts/test_proutes.py @@ -19,7 +19,10 @@ class TestPRoutesCommand(unittest.TestCase): route = dummy.DummyRoute('a', '/a') mapper = dummy.DummyMapper(route) cmd._get_mapper = lambda *arg: mapper + L = [] + cmd.out = lambda msg: L.append(msg) cmd.run() + self.assertTrue('' in ''.join(L)) def test_bad_args(self): cmd = self._getTargetClass()([]) -- cgit v1.2.3 From e96817beccacd6e9cc7f6e0f13698ab891226dbc Mon Sep 17 00:00:00 2001 From: John Anderson Date: Wed, 14 Nov 2012 11:32:17 -0300 Subject: Don't use a global mutable and updated the doc string to include options --- pyramid/paster.py | 8 ++++++-- pyramid/tests/test_scripts/test_prequest.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyramid/paster.py b/pyramid/paster.py index b1a6d4c8b..6dd7f9086 100644 --- a/pyramid/paster.py +++ b/pyramid/paster.py @@ -9,7 +9,7 @@ from pyramid.compat import configparser from logging.config import fileConfig from pyramid.scripting import prepare -def get_app(config_uri, name=None, options={}, loadapp=loadapp): +def get_app(config_uri, name=None, options=None, loadapp=loadapp): """ Return the WSGI application named ``name`` in the PasteDeploy config file specified by ``config_uri``. @@ -72,7 +72,7 @@ def _getpathsec(config_uri, name): section = name return path, section -def bootstrap(config_uri, request=None, options={}): +def bootstrap(config_uri, request=None, options=None): """ Load a WSGI application from the PasteDeploy config file specified by ``config_uri``. The environment will be configured as if it is currently serving ``request``, leaving a natural environment in place @@ -112,6 +112,10 @@ def bootstrap(config_uri, request=None, options={}): for you if none is provided. You can mutate the request's ``environ`` later to setup a specific host/port/scheme/etc. + ``options`` Is passed to get_app for use as variable assignments like + {'http_port': 8080} and then use %(http_port)s in the + config file. + See :ref:`writing_a_script` for more information about how to use this function. """ diff --git a/pyramid/tests/test_scripts/test_prequest.py b/pyramid/tests/test_scripts/test_prequest.py index 76cb35881..91d2b322a 100644 --- a/pyramid/tests/test_scripts/test_prequest.py +++ b/pyramid/tests/test_scripts/test_prequest.py @@ -13,10 +13,10 @@ class TestPRequestCommand(unittest.TestCase): cmd.out = self.out return cmd - def get_app(self, spec, app_name=None, options={}): + def get_app(self, spec, app_name=None, options=None): self._spec = spec self._app_name = app_name - self._options = options + self._options = options or {} def helloworld(environ, start_request): self._environ = environ -- cgit v1.2.3 From edab820875af1670fc298bc174e824d7b2de8f81 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Wed, 14 Nov 2012 11:34:19 -0300 Subject: Added myself to contributors --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index d03da3e62..85b520975 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -188,3 +188,5 @@ Contributors - Domen Kozar, 2012/09/11 - David Gay, 2012/09/16 + +- John Anderson, 2012/11/14 -- cgit v1.2.3 From 0ccdc23f6ec53548bb1f81f3b528f2a8be0a5467 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 18 Nov 2012 21:47:32 -0500 Subject: - A failure when trying to locate the attribute ``__text__`` on route and view predicates existed when the ``debug_routematch`` setting was true or when the ``pviews`` command was used. See https://github.com/Pylons/pyramid/pull/727 Closes #727. --- CHANGES.txt | 10 ++++++++++ pyramid/config/util.py | 8 ++++++-- pyramid/router.py | 2 +- pyramid/scripts/pviews.py | 2 +- pyramid/tests/test_router.py | 17 ++++++++++++++--- pyramid/tests/test_scripts/test_pviews.py | 2 +- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9f5ce064f..f5c5c9449 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,13 @@ +Next release +============ + +Bug Fixes +--------- + +- A failure when trying to locate the attribute ``__text__`` on route and view + predicates existed when the ``debug_routematch`` setting was true or when the + ``pviews`` command was used. See https://github.com/Pylons/pyramid/pull/727 + 1.4a4 (2012-11-14) ================== diff --git a/pyramid/config/util.py b/pyramid/config/util.py index c16755a75..a83e23798 100644 --- a/pyramid/config/util.py +++ b/pyramid/config/util.py @@ -42,8 +42,12 @@ class PredicateList(object): ## weighs_more_than = self.last_added or FIRST ## weighs_less_than = LAST self.last_added = name - self.sorter.add(name, factory, after=weighs_more_than, - before=weighs_less_than) + self.sorter.add( + name, + factory, + after=weighs_more_than, + before=weighs_less_than, + ) def make(self, config, **kw): # Given a configurator and a list of keywords, a predicate list is diff --git a/pyramid/router.py b/pyramid/router.py index 0c7f61071..9b6138ea9 100644 --- a/pyramid/router.py +++ b/pyramid/router.py @@ -103,7 +103,7 @@ class Router(object): request.path_info, route.pattern, match, - ', '.join([p.__text__ for p in route.predicates])) + ', '.join([p.text() for p in route.predicates])) ) logger and logger.debug(msg) diff --git a/pyramid/scripts/pviews.py b/pyramid/scripts/pviews.py index a9db59dc1..60aecb9bb 100644 --- a/pyramid/scripts/pviews.py +++ b/pyramid/scripts/pviews.py @@ -187,7 +187,7 @@ class PViewsCommand(object): self.out("%sroute pattern: %s" % (indent, route.pattern)) self.out("%sroute path: %s" % (indent, route.path)) self.out("%ssubpath: %s" % (indent, '/'.join(attrs['subpath']))) - predicates = ', '.join([p.__text__ for p in route.predicates]) + predicates = ', '.join([p.text() for p in route.predicates]) if predicates != '': self.out("%sroute predicates (%s)" % (indent, predicates)) diff --git a/pyramid/tests/test_router.py b/pyramid/tests/test_router.py index 778b27473..65152ca05 100644 --- a/pyramid/tests/test_router.py +++ b/pyramid/tests/test_router.py @@ -24,7 +24,7 @@ class TestRouter(unittest.TestCase): if mapper is None: mapper = RoutesMapper() self.registry.registerUtility(mapper, IRoutesMapper) - mapper.connect(name, path, factory) + return mapper.connect(name, path, factory) def _registerLogger(self): from pyramid.interfaces import IDebugLogger @@ -657,7 +657,8 @@ class TestRouter(unittest.TestCase): root = object() def factory(request): return root - self._connectRoute('foo', 'archives/:action/:article', factory) + route = self._connectRoute('foo', 'archives/:action/:article', factory) + route.predicates = [DummyPredicate()] context = DummyContext() self._registerTraverserFactory(context) response = DummyResponse() @@ -686,7 +687,11 @@ class TestRouter(unittest.TestCase): "route matched for url http://localhost:8080" "/archives/action1/article1; " "route_name: 'foo', " - "path_info: ")) + "path_info: ") + ) + self.assertTrue( + "predicates: 'predicate'" in logger.messages[0] + ) def test_call_route_match_miss_debug_routematch(self): from pyramid.httpexceptions import HTTPNotFound @@ -1159,6 +1164,12 @@ class TestRouter(unittest.TestCase): start_response = DummyStartResponse() self.assertRaises(RuntimeError, router, environ, start_response) +class DummyPredicate(object): + def __call__(self, info, request): + return True + def text(self): + return 'predicate' + class DummyContext: pass diff --git a/pyramid/tests/test_scripts/test_pviews.py b/pyramid/tests/test_scripts/test_pviews.py index 6a919c31b..266d1ec90 100644 --- a/pyramid/tests/test_scripts/test_pviews.py +++ b/pyramid/tests/test_scripts/test_pviews.py @@ -379,7 +379,7 @@ class TestPViewsCommand(unittest.TestCase): L = [] command.out = L.append def predicate(): pass - predicate.__text__ = "predicate = x" + predicate.text = lambda *arg: "predicate = x" route = dummy.DummyRoute('a', '/a', matchdict={}, predicate=predicate) view = dummy.DummyView(context='context', view_name='a', matched_route=route, subpath='') -- cgit v1.2.3 From c344e532e27ce078643ec3246002d2703ef85416 Mon Sep 17 00:00:00 2001 From: Patricio Paez Date: Mon, 19 Nov 2012 21:03:46 -0600 Subject: Sync some SQL wiki tutorial files with the scaffold - Files that are not referred to in a literalinclude in the tutorial docs - setup.py appears in literalinclude, but no lines are added or removed so no impact. Fixed docutils order in the requires list. --- docs/tutorials/wiki2/src/authorization/README.txt | 13 +++++++++++++ .../wiki2/src/authorization/development.ini | 20 +++++++++++++++++--- docs/tutorials/wiki2/src/authorization/setup.py | 9 +++++---- docs/tutorials/wiki2/src/basiclayout/README.txt | 13 +++++++++++++ docs/tutorials/wiki2/src/basiclayout/development.ini | 20 +++++++++++++++++--- docs/tutorials/wiki2/src/basiclayout/production.ini | 12 +++++++++--- docs/tutorials/wiki2/src/basiclayout/setup.py | 6 +++--- .../src/basiclayout/tutorial/templates/mytemplate.pt | 2 +- docs/tutorials/wiki2/src/models/README.txt | 13 +++++++++++++ docs/tutorials/wiki2/src/models/development.ini | 20 +++++++++++++++++--- docs/tutorials/wiki2/src/models/setup.py | 6 +++--- docs/tutorials/wiki2/src/tests/README.txt | 13 +++++++++++++ docs/tutorials/wiki2/src/tests/development.ini | 20 +++++++++++++++++--- docs/tutorials/wiki2/src/tests/setup.py | 7 ++++--- docs/tutorials/wiki2/src/views/README.txt | 13 +++++++++++++ docs/tutorials/wiki2/src/views/development.ini | 20 +++++++++++++++++--- docs/tutorials/wiki2/src/views/setup.py | 6 +++--- 17 files changed, 178 insertions(+), 35 deletions(-) diff --git a/docs/tutorials/wiki2/src/authorization/README.txt b/docs/tutorials/wiki2/src/authorization/README.txt index 6f851e9b7..141851285 100644 --- a/docs/tutorials/wiki2/src/authorization/README.txt +++ b/docs/tutorials/wiki2/src/authorization/README.txt @@ -1 +1,14 @@ tutorial README +================== + +Getting Started +--------------- + +- cd + +- $venv/bin/python setup.py develop + +- $venv/bin/initialize_tutorial_db development.ini + +- $venv/bin/pserve development.ini + diff --git a/docs/tutorials/wiki2/src/authorization/development.ini b/docs/tutorials/wiki2/src/authorization/development.ini index eb2f878c5..a9d53b296 100644 --- a/docs/tutorials/wiki2/src/authorization/development.ini +++ b/docs/tutorials/wiki2/src/authorization/development.ini @@ -1,3 +1,8 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial @@ -12,12 +17,23 @@ pyramid.includes = sqlalchemy.url = sqlite:///%(here)s/tutorial.sqlite +# 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, tutorial, sqlalchemy @@ -53,5 +69,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/wiki2/src/authorization/setup.py b/docs/tutorials/wiki2/src/authorization/setup.py index 2fd051927..d658cae93 100644 --- a/docs/tutorials/wiki2/src/authorization/setup.py +++ b/docs/tutorials/wiki2/src/authorization/setup.py @@ -13,8 +13,8 @@ requires = [ 'pyramid_tm', 'pyramid_debugtoolbar', 'zope.sqlalchemy', - 'docutils', 'waitress', + 'docutils', ] setup(name='tutorial', @@ -23,7 +23,7 @@ setup(name='tutorial', long_description=README + '\n\n' + CHANGES, classifiers=[ "Programming Language :: Python", - "Framework :: Pylons", + "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], @@ -35,11 +35,12 @@ setup(name='tutorial', include_package_data=True, zip_safe=False, test_suite='tutorial', - install_requires = requires, - entry_points = """\ + install_requires=requires, + entry_points="""\ [paste.app_factory] main = tutorial:main [console_scripts] initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) + diff --git a/docs/tutorials/wiki2/src/basiclayout/README.txt b/docs/tutorials/wiki2/src/basiclayout/README.txt index 6f851e9b7..141851285 100644 --- a/docs/tutorials/wiki2/src/basiclayout/README.txt +++ b/docs/tutorials/wiki2/src/basiclayout/README.txt @@ -1 +1,14 @@ tutorial README +================== + +Getting Started +--------------- + +- cd + +- $venv/bin/python setup.py develop + +- $venv/bin/initialize_tutorial_db development.ini + +- $venv/bin/pserve development.ini + diff --git a/docs/tutorials/wiki2/src/basiclayout/development.ini b/docs/tutorials/wiki2/src/basiclayout/development.ini index eb2f878c5..a9d53b296 100644 --- a/docs/tutorials/wiki2/src/basiclayout/development.ini +++ b/docs/tutorials/wiki2/src/basiclayout/development.ini @@ -1,3 +1,8 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial @@ -12,12 +17,23 @@ pyramid.includes = sqlalchemy.url = sqlite:///%(here)s/tutorial.sqlite +# 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, tutorial, sqlalchemy @@ -53,5 +69,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/wiki2/src/basiclayout/production.ini b/docs/tutorials/wiki2/src/basiclayout/production.ini index 4684d2f7a..fa94c1b3e 100644 --- a/docs/tutorials/wiki2/src/basiclayout/production.ini +++ b/docs/tutorials/wiki2/src/basiclayout/production.ini @@ -1,3 +1,8 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial @@ -16,7 +21,10 @@ 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, sqlalchemy @@ -52,5 +60,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/wiki2/src/basiclayout/setup.py b/docs/tutorials/wiki2/src/basiclayout/setup.py index 050de7299..1a1ad78aa 100644 --- a/docs/tutorials/wiki2/src/basiclayout/setup.py +++ b/docs/tutorials/wiki2/src/basiclayout/setup.py @@ -22,7 +22,7 @@ setup(name='tutorial', long_description=README + '\n\n' + CHANGES, classifiers=[ "Programming Language :: Python", - "Framework :: Pylons", + "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], @@ -34,8 +34,8 @@ setup(name='tutorial', include_package_data=True, zip_safe=False, test_suite='tutorial', - install_requires = requires, - entry_points = """\ + install_requires=requires, + entry_points="""\ [paste.app_factory] main = tutorial:main [console_scripts] diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt index fbfa9870b..15ea6614f 100644 --- a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt +++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt @@ -70,7 +70,7 @@ diff --git a/docs/tutorials/wiki2/src/models/README.txt b/docs/tutorials/wiki2/src/models/README.txt index 6f851e9b7..141851285 100644 --- a/docs/tutorials/wiki2/src/models/README.txt +++ b/docs/tutorials/wiki2/src/models/README.txt @@ -1 +1,14 @@ tutorial README +================== + +Getting Started +--------------- + +- cd + +- $venv/bin/python setup.py develop + +- $venv/bin/initialize_tutorial_db development.ini + +- $venv/bin/pserve development.ini + diff --git a/docs/tutorials/wiki2/src/models/development.ini b/docs/tutorials/wiki2/src/models/development.ini index eb2f878c5..a9d53b296 100644 --- a/docs/tutorials/wiki2/src/models/development.ini +++ b/docs/tutorials/wiki2/src/models/development.ini @@ -1,3 +1,8 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial @@ -12,12 +17,23 @@ pyramid.includes = sqlalchemy.url = sqlite:///%(here)s/tutorial.sqlite +# 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, tutorial, sqlalchemy @@ -53,5 +69,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/wiki2/src/models/setup.py b/docs/tutorials/wiki2/src/models/setup.py index 050de7299..1a1ad78aa 100644 --- a/docs/tutorials/wiki2/src/models/setup.py +++ b/docs/tutorials/wiki2/src/models/setup.py @@ -22,7 +22,7 @@ setup(name='tutorial', long_description=README + '\n\n' + CHANGES, classifiers=[ "Programming Language :: Python", - "Framework :: Pylons", + "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], @@ -34,8 +34,8 @@ setup(name='tutorial', include_package_data=True, zip_safe=False, test_suite='tutorial', - install_requires = requires, - entry_points = """\ + install_requires=requires, + entry_points="""\ [paste.app_factory] main = tutorial:main [console_scripts] diff --git a/docs/tutorials/wiki2/src/tests/README.txt b/docs/tutorials/wiki2/src/tests/README.txt index 6f851e9b7..141851285 100644 --- a/docs/tutorials/wiki2/src/tests/README.txt +++ b/docs/tutorials/wiki2/src/tests/README.txt @@ -1 +1,14 @@ tutorial README +================== + +Getting Started +--------------- + +- cd + +- $venv/bin/python setup.py develop + +- $venv/bin/initialize_tutorial_db development.ini + +- $venv/bin/pserve development.ini + diff --git a/docs/tutorials/wiki2/src/tests/development.ini b/docs/tutorials/wiki2/src/tests/development.ini index eb2f878c5..a9d53b296 100644 --- a/docs/tutorials/wiki2/src/tests/development.ini +++ b/docs/tutorials/wiki2/src/tests/development.ini @@ -1,3 +1,8 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial @@ -12,12 +17,23 @@ pyramid.includes = sqlalchemy.url = sqlite:///%(here)s/tutorial.sqlite +# 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, tutorial, sqlalchemy @@ -53,5 +69,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/wiki2/src/tests/setup.py b/docs/tutorials/wiki2/src/tests/setup.py index 0f58d8a18..8a619d27b 100644 --- a/docs/tutorials/wiki2/src/tests/setup.py +++ b/docs/tutorials/wiki2/src/tests/setup.py @@ -24,7 +24,7 @@ setup(name='tutorial', long_description=README + '\n\n' + CHANGES, classifiers=[ "Programming Language :: Python", - "Framework :: Pylons", + "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], @@ -36,11 +36,12 @@ setup(name='tutorial', include_package_data=True, zip_safe=False, test_suite='tutorial', - install_requires = requires, - entry_points = """\ + install_requires=requires, + entry_points="""\ [paste.app_factory] main = tutorial:main [console_scripts] initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) + diff --git a/docs/tutorials/wiki2/src/views/README.txt b/docs/tutorials/wiki2/src/views/README.txt index 6f851e9b7..141851285 100644 --- a/docs/tutorials/wiki2/src/views/README.txt +++ b/docs/tutorials/wiki2/src/views/README.txt @@ -1 +1,14 @@ tutorial README +================== + +Getting Started +--------------- + +- cd + +- $venv/bin/python setup.py develop + +- $venv/bin/initialize_tutorial_db development.ini + +- $venv/bin/pserve development.ini + diff --git a/docs/tutorials/wiki2/src/views/development.ini b/docs/tutorials/wiki2/src/views/development.ini index eb2f878c5..a9d53b296 100644 --- a/docs/tutorials/wiki2/src/views/development.ini +++ b/docs/tutorials/wiki2/src/views/development.ini @@ -1,3 +1,8 @@ +### +# app configuration +# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html +### + [app:main] use = egg:tutorial @@ -12,12 +17,23 @@ pyramid.includes = sqlalchemy.url = sqlite:///%(here)s/tutorial.sqlite +# 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, tutorial, sqlalchemy @@ -53,5 +69,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/wiki2/src/views/setup.py b/docs/tutorials/wiki2/src/views/setup.py index 34b578e21..d658cae93 100644 --- a/docs/tutorials/wiki2/src/views/setup.py +++ b/docs/tutorials/wiki2/src/views/setup.py @@ -23,7 +23,7 @@ setup(name='tutorial', long_description=README + '\n\n' + CHANGES, classifiers=[ "Programming Language :: Python", - "Framework :: Pylons", + "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], @@ -35,8 +35,8 @@ setup(name='tutorial', include_package_data=True, zip_safe=False, test_suite='tutorial', - install_requires = requires, - entry_points = """\ + install_requires=requires, + entry_points="""\ [paste.app_factory] main = tutorial:main [console_scripts] -- cgit v1.2.3 From 6234f4a25a59658ccc66fe3d2b1c248ba96f5344 Mon Sep 17 00:00:00 2001 From: Patricio Paez Date: Mon, 19 Nov 2012 22:35:36 -0600 Subject: Sync some ZODB wiki tutorial files with the scaffold - Files that are not referred to in a literalinclude in the tutorial docs - setup.py and development.ini appear in a literalinclude but no lines are emphasized and there is no impact. --- .../wiki/src/authorization/development.ini | 26 +++++++++++++++++-- .../wiki/src/authorization/production.ini | 17 +++++++++--- docs/tutorials/wiki/src/authorization/setup.py | 7 +++-- .../authorization/tutorial/templates/mytemplate.pt | 6 ++--- .../tutorials/wiki/src/basiclayout/development.ini | 30 ++++++++++++++++++---- docs/tutorials/wiki/src/basiclayout/production.ini | 17 +++++++++--- docs/tutorials/wiki/src/basiclayout/setup.py | 2 +- .../basiclayout/tutorial/templates/mytemplate.pt | 4 +-- docs/tutorials/wiki/src/models/development.ini | 28 +++++++++++++++++--- docs/tutorials/wiki/src/models/production.ini | 17 +++++++++--- docs/tutorials/wiki/src/models/setup.py | 2 +- .../src/models/tutorial/templates/mytemplate.pt | 6 ++--- docs/tutorials/wiki/src/tests/development.ini | 26 +++++++++++++++++-- docs/tutorials/wiki/src/tests/production.ini | 17 +++++++++--- docs/tutorials/wiki/src/tests/setup.py | 7 +++-- .../src/tests/tutorial/templates/mytemplate.pt | 6 ++--- docs/tutorials/wiki/src/views/development.ini | 28 +++++++++++++++++--- docs/tutorials/wiki/src/views/production.ini | 17 +++++++++--- docs/tutorials/wiki/src/views/setup.py | 8 +++--- .../src/views/tutorial/templates/mytemplate.pt | 6 ++--- 20 files changed, 218 insertions(+), 59 deletions(-) diff --git a/docs/tutorials/wiki/src/authorization/development.ini b/docs/tutorials/wiki/src/authorization/development.ini index 996caa741..c504ec82f 100644 --- a/docs/tutorials/wiki/src/authorization/development.ini +++ b/docs/tutorials/wiki/src/authorization/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,) diff --git a/docs/tutorials/wiki/src/authorization/production.ini b/docs/tutorials/wiki/src/authorization/production.ini index ca8107802..d9bf27c42 100644 --- a/docs/tutorials/wiki/src/authorization/production.ini +++ b/docs/tutorials/wiki/src/authorization/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/authorization/setup.py b/docs/tutorials/wiki/src/authorization/setup.py index 31c51dbcf..ac8cdf2d5 100644 --- a/docs/tutorials/wiki/src/authorization/setup.py +++ b/docs/tutorials/wiki/src/authorization/setup.py @@ -21,9 +21,8 @@ setup(name='tutorial', description='tutorial', 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", ], @@ -34,8 +33,8 @@ setup(name='tutorial', packages=find_packages(), include_package_data=True, zip_safe=False, - install_requires=requires, - tests_require=requires, + install_requires = requires, + tests_require= requires, test_suite="tutorial", entry_points = """\ [paste.app_factory] diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt index 3597c679b..84824f605 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt +++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt @@ -6,9 +6,9 @@ + - @@ -41,7 +41,7 @@

Pyramid links