From 1395f5485c4155a67f4ca0e18507387e02c985d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiss=20Gy=C3=B6rgy?= Date: Sat, 6 Jun 2015 14:40:16 +0200 Subject: More idiomatic code --- docs/narr/viewconfig.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index fc5ae6dc6..46b2c4f76 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -119,7 +119,7 @@ Non-Predicate Arguments ``renderer`` Denotes the :term:`renderer` implementation which will be used to construct a :term:`response` from the associated view callable's return value. - + .. seealso:: See also :ref:`renderers_chapter`. This is either a single string term (e.g. ``json``) or a string implying a @@ -1020,7 +1020,7 @@ there's a ``should_cache`` GET or POST variable: @view_config(http_cache=3600) def view(request): response = Response() - if not 'should_cache' in request.params: + if 'should_cache' not in request.params: response.cache_control.prevent_auto = True return response -- cgit v1.2.3 From f866fa68ffcac3e200e4d530f8c157e5848e60b0 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 6 Jun 2015 15:02:47 -0700 Subject: cherry pick 1.6-branch to master --- docs/narr/assets.rst | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst index d6bc8cbb8..fc02b3f7d 100644 --- a/docs/narr/assets.rst +++ b/docs/narr/assets.rst @@ -512,6 +512,93 @@ time at start up as a cachebust token: .. index:: single: static assets view +CSS and JavaScript source and cache busting +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Often one needs to refer to images and other static assets inside CSS and +JavaScript files. If cache busting is active, the final static asset URL is +not available until the static assets have been assembled. These URLs cannot +be handwritten. Thus, when having static asset references in CSS and +JavaScript, one needs to perform one of the following tasks. + +* Process the files by using a precompiler which rewrites URLs to their final + cache busted form. + +* Templatize JS and CSS, and call ``request.static_url()`` inside their + template code. + +* Pass static URL references to CSS and JavaScript via other means. + +Below are some simple approaches for CSS and JS programming which consider +asset cache busting. These approaches do not require additional tools or +packages. + +Relative cache busted URLs in CSS ++++++++++++++++++++++++++++++++++ + +Consider a CSS file ``/static/theme/css/site.css`` which contains the +following CSS code. + +.. code-block:: css + + body { + background: url(/static/theme/img/background.jpg); + } + +Any changes to ``background.jpg`` would not appear to the visitor because the +URL path is not cache busted as it is. Instead we would have to construct an +URL to the background image with the default ``PathSegmentCacheBuster`` cache +busting mechanism:: + + https://site/static/1eeb262c717/theme/img/background.jpg + +Every time the image is updated, the URL would need to be changed. It is not +practical to write this non-human readable URL into a CSS file. + +However, the CSS file itself is cache busted and is located under the path for +static assets. This lets us use relative references in our CSS to cache bust +the image. + +.. code-block:: css + + body { + background: url(../img/background.jpg); + } + +The browser would interpret this as having the CSS file hash in URL:: + + https://site/static/ab234b262c71/theme/css/../img/background.jpg + +The downside of this approach is that if the background image changes, one +needs to bump the CSS file. The CSS file hash change signals the caches that +the relative URL to the image in the CSS has been changed. When updating CSS +and related image assets, updates usually happen hand in hand, so this does +not add extra effort to theming workflow. + +Passing cache busted URLs to JavaScript ++++++++++++++++++++++++++++++++++++++++ + +For JavaScript, one can pass static asset URLs as function arguments or +globals. The globals can be generated in page template code, having access to +the ``request.static_url()`` function. + +Below is a simple example of passing a cached busted image URL in the Jinja2 +template language. Put the following code into the ```` section of the +relevant page. + +.. code-block:: html + + + +Then in your main ``site.js`` file put the following code. + +.. code-block:: javascript + + var image = new Image(window.assets.backgroundImage); + .. _advanced_static: Advanced: Serving Static Assets Using a View Callable -- cgit v1.2.3 From 7740b65e00a5581c431bbade68be0c471aeccb42 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 9 Jun 2015 11:36:25 -0400 Subject: Return concrete classes from 'pyramid.httpexceptions.exception_response'. The base classes are not appropriate for 400 and 500 status codes. See: #1832 --- pyramid/httpexceptions.py | 16 ++++++++-------- pyramid/tests/test_httpexceptions.py | 13 +++++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 465769834..93d06e0d6 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -562,10 +562,7 @@ class HTTPClientError(HTTPError): a bug. A server-side traceback is not warranted. Unless specialized, this is a '400 Bad Request' """ - code = 400 - title = 'Bad Request' - explanation = ('The server could not comply with the request since ' - 'it is either malformed or otherwise incorrect.') + pass class HTTPBadRequest(HTTPClientError): """ @@ -576,7 +573,10 @@ class HTTPBadRequest(HTTPClientError): code: 400, title: Bad Request """ - pass + code = 400 + title = 'Bad Request' + explanation = ('The server could not comply with the request since ' + 'it is either malformed or otherwise incorrect.') class HTTPUnauthorized(HTTPClientError): """ @@ -988,15 +988,15 @@ class HTTPServerError(HTTPError): This is an error condition in which the server is presumed to be in-error. Unless specialized, this is a '500 Internal Server Error'. """ + pass + +class HTTPInternalServerError(HTTPServerError): code = 500 title = 'Internal Server Error' explanation = ( 'The server has either erred or is incapable of performing ' 'the requested operation.') -class HTTPInternalServerError(HTTPServerError): - pass - class HTTPNotImplemented(HTTPServerError): """ subclass of :class:`~HTTPServerError` diff --git a/pyramid/tests/test_httpexceptions.py b/pyramid/tests/test_httpexceptions.py index d0779e080..c700dc80e 100644 --- a/pyramid/tests/test_httpexceptions.py +++ b/pyramid/tests/test_httpexceptions.py @@ -10,13 +10,22 @@ class Test_exception_response(unittest.TestCase): from pyramid.httpexceptions import exception_response return exception_response(*arg, **kw) + def test_status_400(self): + from pyramid.httpexceptions import HTTPBadRequest + self.assertTrue(isinstance(self._callFUT(400), HTTPBadRequest)) + def test_status_404(self): from pyramid.httpexceptions import HTTPNotFound - self.assertEqual(self._callFUT(404).__class__, HTTPNotFound) + self.assertTrue(isinstance(self._callFUT(404), HTTPNotFound)) + + def test_status_500(self): + from pyramid.httpexceptions import HTTPInternalServerError + self.assertTrue(isinstance(self._callFUT(500), + HTTPInternalServerError)) def test_status_201(self): from pyramid.httpexceptions import HTTPCreated - self.assertEqual(self._callFUT(201).__class__, HTTPCreated) + self.assertTrue(isinstance(self._callFUT(201), HTTPCreated)) def test_extra_kw(self): resp = self._callFUT(404, headers=[('abc', 'def')]) -- cgit v1.2.3 From 589a398c2a538f7f58775d1a841249540ac7134a Mon Sep 17 00:00:00 2001 From: Igor Stroh Date: Wed, 10 Jun 2015 22:13:54 +0200 Subject: handle conflicting project names gracefully, fixes: #1357 - Check for importable packages/modules with the same name as the package to be created - Added --force-conflicting-name option to enforce the use of a conflicting package - Added appropriate tests --- pyramid/scripts/pcreate.py | 103 +++++++++++++++++++++++------ pyramid/tests/test_scripts/test_pcreate.py | 46 ++++++++++++- 2 files changed, 129 insertions(+), 20 deletions(-) diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index f6376f575..5ef0ac2d5 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -13,7 +13,21 @@ _bad_chars_re = re.compile('[^a-zA-Z0-9_]') def main(argv=sys.argv, quiet=False): command = PCreateCommand(argv, quiet) - return command.run() + try: + return command.run() + except KeyboardInterrupt: # pragma: no cover + return 1 + + +class InvalidInputError(Exception): + """ This is raised in case a project name is + missing or a scaffold name was omitted. + """ + pass + +class ExistingProjectNameError(InvalidInputError): + pass + class PCreateCommand(object): verbosity = 1 # required @@ -52,6 +66,13 @@ class PCreateCommand(object): dest='interactive', action='store_true', help='When a file would be overwritten, interrogate') + parser.add_option('--force-conflicting-name', + dest='force_bad_name', + action='store_true', + default=False, + help='Do create a project even if the chosen name ' + 'is the name of an already existing / importable ' + 'package.') pyramid_dist = pkg_resources.get_distribution("pyramid") @@ -69,25 +90,21 @@ class PCreateCommand(object): self.out('') self.show_scaffolds() return 2 - if not self.options.scaffold_name: - self.out('You must provide at least one scaffold name: -s ') - self.out('') - self.show_scaffolds() - return 2 - if not self.args: - self.out('You must provide a project name') - return 2 - available = [x.name for x in self.scaffolds] - diff = set(self.options.scaffold_name).difference(available) - if diff: - self.out('Unavailable scaffolds: %s' % list(diff)) + + if not self.validate_input(): return 2 + return self.render_scaffolds() - def render_scaffolds(self): + @property + def output_path(self): + return os.path.abspath(os.path.normpath(self.args[0])) + + @property + def project_vars(self): options = self.options args = self.args - output_dir = os.path.abspath(os.path.normpath(args[0])) + output_dir = self.output_path project_name = os.path.basename(os.path.split(output_dir)[1]) pkg_name = _bad_chars_re.sub( '', project_name.lower().replace('-', '_')) @@ -111,17 +128,22 @@ class PCreateCommand(object): else: pyramid_docs_branch = 'latest' - vars = { + return { 'project': project_name, 'package': pkg_name, 'egg': egg_name, 'pyramid_version': pyramid_version, 'pyramid_docs_branch': pyramid_docs_branch, - } - for scaffold_name in options.scaffold_name: + } + + + def render_scaffolds(self): + props = self.project_vars + output_dir = self.output_path + for scaffold_name in self.options.scaffold_name: for scaffold in self.scaffolds: if scaffold.name == scaffold_name: - scaffold.run(self, output_dir, vars) + scaffold.run(self, output_dir, props) return 0 def show_scaffolds(self): @@ -154,5 +176,48 @@ class PCreateCommand(object): if not self.quiet: print(msg) + def validate_input(self): + if not self.options.scaffold_name: + self.out('You must provide at least one scaffold name: -s ') + self.out('') + self.show_scaffolds() + return False + if not self.args: + self.out('You must provide a project name') + return False + available = [x.name for x in self.scaffolds] + diff = set(self.options.scaffold_name).difference(available) + if diff: + self.out('Unavailable scaffolds: %s' % ", ".join(list(diff))) + return False + + pkg_name = self.project_vars['package'] + + if pkg_name == 'site' and not self.options.force_bad_name: + self.out('The package name "site" has a special meaning in ' + 'Python. Are you sure you want to use it as your ' + 'project\'s name?') + return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) + + # check if pkg_name can be imported (i.e. already exists in current + # $PYTHON_PATH, if so - let the user confirm + pkg_exists = True + try: + __import__(pkg_name, globals(), locals(), [], 0) # use absolute imports + except ImportError as error: + pkg_exists = False + if not pkg_exists: + return True + + if self.options.force_bad_name: + return True + self.out('Package "{}" already exists, are you sure you want ' + 'to use it as your project\'s name?'.format(pkg_name)) + return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) + + def confirm_bad_name(self, prompt): # pragma: no cover + answer = raw_input('{} [y|N]: '.format(prompt)) + return answer.strip().lower() == 'y' + if __name__ == '__main__': # pragma: no cover sys.exit(main() or 0) diff --git a/pyramid/tests/test_scripts/test_pcreate.py b/pyramid/tests/test_scripts/test_pcreate.py index 63e5e6368..8fc9c1267 100644 --- a/pyramid/tests/test_scripts/test_pcreate.py +++ b/pyramid/tests/test_scripts/test_pcreate.py @@ -1,5 +1,6 @@ import unittest + class TestPCreateCommand(unittest.TestCase): def setUp(self): from pyramid.compat import NativeIO @@ -15,7 +16,8 @@ class TestPCreateCommand(unittest.TestCase): def _makeOne(self, *args, **kw): effargs = ['pcreate'] effargs.extend(args) - cmd = self._getTargetClass()(effargs, **kw) + tgt_class = kw.pop('target_class', self._getTargetClass()) + cmd = tgt_class(effargs, **kw) cmd.out = self.out return cmd @@ -220,6 +222,48 @@ class TestPCreateCommand(unittest.TestCase): 'pyramid_version': '0.10.1dev', 'pyramid_docs_branch': 'master'}) + def test_confirm_override_conflicting_name(self): + from pyramid.scripts.pcreate import PCreateCommand + class YahInputPCreateCommand(PCreateCommand): + def confirm_bad_name(self, pkg_name): + return True + cmd = self._makeOne('-s', 'dummy', 'Unittest', target_class=YahInputPCreateCommand) + scaffold = DummyScaffold('dummy') + cmd.scaffolds = [scaffold] + cmd.pyramid_dist = DummyDist("0.10.1dev") + result = cmd.run() + self.assertEqual(result, 0) + self.assertEqual( + scaffold.vars, + {'project': 'Unittest', 'egg': 'Unittest', 'package': 'unittest', + 'pyramid_version': '0.10.1dev', + 'pyramid_docs_branch': 'master'}) + + def test_force_override_conflicting_name(self): + cmd = self._makeOne('-s', 'dummy', 'Unittest', '--force-conflicting-name') + scaffold = DummyScaffold('dummy') + cmd.scaffolds = [scaffold] + cmd.pyramid_dist = DummyDist("0.10.1dev") + result = cmd.run() + self.assertEqual(result, 0) + self.assertEqual( + scaffold.vars, + {'project': 'Unittest', 'egg': 'Unittest', 'package': 'unittest', + 'pyramid_version': '0.10.1dev', + 'pyramid_docs_branch': 'master'}) + + def test_force_override_site_name(self): + from pyramid.scripts.pcreate import PCreateCommand + class NayInputPCreateCommand(PCreateCommand): + def confirm_bad_name(self, pkg_name): + return False + cmd = self._makeOne('-s', 'dummy', 'Site', target_class=NayInputPCreateCommand) + scaffold = DummyScaffold('dummy') + cmd.scaffolds = [scaffold] + cmd.pyramid_dist = DummyDist("0.10.1dev") + result = cmd.run() + self.assertEqual(result, 2) + class Test_main(unittest.TestCase): def _callFUT(self, argv): -- cgit v1.2.3 From 08110f881e2fc29f48d1983c1f86a4e3b65ba8c3 Mon Sep 17 00:00:00 2001 From: Igor Stroh Date: Wed, 10 Jun 2015 22:18:14 +0200 Subject: removed unused exceptions --- pyramid/scripts/pcreate.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index 5ef0ac2d5..b59c1d8b4 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -19,16 +19,6 @@ def main(argv=sys.argv, quiet=False): return 1 -class InvalidInputError(Exception): - """ This is raised in case a project name is - missing or a scaffold name was omitted. - """ - pass - -class ExistingProjectNameError(InvalidInputError): - pass - - class PCreateCommand(object): verbosity = 1 # required description = "Render Pyramid scaffolding to an output directory" -- cgit v1.2.3 From e7a731c1dc6d6e56acf978c44ad9e4f095695b8d Mon Sep 17 00:00:00 2001 From: Igor Stroh Date: Wed, 10 Jun 2015 22:37:57 +0200 Subject: make sure user input is py2.x/py3 compatible - Use input() in python3 and raw_input in python 2.x - Remoced unused local variables --- pyramid/scaffolds/__init__.py | 4 ---- pyramid/scripts/pcreate.py | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pyramid/scaffolds/__init__.py b/pyramid/scaffolds/__init__.py index c993ce5f9..4e811a42b 100644 --- a/pyramid/scaffolds/__init__.py +++ b/pyramid/scaffolds/__init__.py @@ -18,10 +18,6 @@ class PyramidTemplate(Template): misnamings (such as naming a package "site" or naming a package logger "root". """ - if vars['package'] == 'site': - raise ValueError('Sorry, you may not name your package "site". ' - 'The package name "site" has a special meaning in ' - 'Python. Please name it anything except "site".') vars['random_string'] = native_(binascii.hexlify(os.urandom(20))) package_logger = vars['package'] if package_logger == 'root': diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index b59c1d8b4..2c05d87b2 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -9,6 +9,8 @@ import pkg_resources import re import sys +user_input = input if sys.version_info[0] == 3 else raw_input + _bad_chars_re = re.compile('[^a-zA-Z0-9_]') def main(argv=sys.argv, quiet=False): @@ -92,8 +94,6 @@ class PCreateCommand(object): @property def project_vars(self): - options = self.options - args = self.args output_dir = self.output_path project_name = os.path.basename(os.path.split(output_dir)[1]) pkg_name = _bad_chars_re.sub( @@ -202,11 +202,11 @@ class PCreateCommand(object): if self.options.force_bad_name: return True self.out('Package "{}" already exists, are you sure you want ' - 'to use it as your project\'s name?'.format(pkg_name)) + 'to use it as your project\'s name?'.format(pkg_name)) return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) def confirm_bad_name(self, prompt): # pragma: no cover - answer = raw_input('{} [y|N]: '.format(prompt)) + answer = user_input('{} [y|N]: '.format(prompt)) return answer.strip().lower() == 'y' if __name__ == '__main__': # pragma: no cover -- cgit v1.2.3 From 7dc81f082adba97effc3ce3726e453ec71e841b7 Mon Sep 17 00:00:00 2001 From: Igor Stroh Date: Wed, 10 Jun 2015 23:11:42 +0200 Subject: added py2.6 compatibility, removed test for 'site' - Made sure str.format() calls are py2.6 compatible - Removed test_scaffolds/test_init.py#test_pre_site since the check is handled in pcreate script --- pyramid/scripts/pcreate.py | 13 ++++++++----- pyramid/tests/test_scaffolds/test_init.py | 5 ----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index 2c05d87b2..881aacac3 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -9,7 +9,10 @@ import pkg_resources import re import sys -user_input = input if sys.version_info[0] == 3 else raw_input +if sys.version_info[0] == 3: + user_input = input # pragma: no cover +else: + user_input = raw_input # NOQA _bad_chars_re = re.compile('[^a-zA-Z0-9_]') @@ -187,7 +190,7 @@ class PCreateCommand(object): self.out('The package name "site" has a special meaning in ' 'Python. Are you sure you want to use it as your ' 'project\'s name?') - return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) + return self.confirm_bad_name('Really use "{0}"?: '.format(pkg_name)) # check if pkg_name can be imported (i.e. already exists in current # $PYTHON_PATH, if so - let the user confirm @@ -201,12 +204,12 @@ class PCreateCommand(object): if self.options.force_bad_name: return True - self.out('Package "{}" already exists, are you sure you want ' + self.out('Package "{0}" already exists, are you sure you want ' 'to use it as your project\'s name?'.format(pkg_name)) - return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) + return self.confirm_bad_name('Really use "{0}"?: '.format(pkg_name)) def confirm_bad_name(self, prompt): # pragma: no cover - answer = user_input('{} [y|N]: '.format(prompt)) + answer = user_input('{0} [y|N]: '.format(prompt)) return answer.strip().lower() == 'y' if __name__ == '__main__': # pragma: no cover diff --git a/pyramid/tests/test_scaffolds/test_init.py b/pyramid/tests/test_scaffolds/test_init.py index 4988e66ff..f4d1b287a 100644 --- a/pyramid/tests/test_scaffolds/test_init.py +++ b/pyramid/tests/test_scaffolds/test_init.py @@ -12,11 +12,6 @@ class TestPyramidTemplate(unittest.TestCase): self.assertTrue(vars['random_string']) self.assertEqual(vars['package_logger'], 'one') - def test_pre_site(self): - inst = self._makeOne() - vars = {'package':'site'} - self.assertRaises(ValueError, inst.pre, 'command', 'output dir', vars) - def test_pre_root(self): inst = self._makeOne() vars = {'package':'root'} -- cgit v1.2.3 From f09cc1b354f093bd2afd24085a7e747b0867be8b Mon Sep 17 00:00:00 2001 From: Igor Stroh Date: Thu, 11 Jun 2015 00:08:33 +0200 Subject: use input_ from p.compat, renamed option - Use pyramid.compat.input_ instead of manually checking for python version and chosing the appropriate input/raw_input function - Renamed--force-conflicting-name option to --ignore-conflicting-name - Display invalid scaffold names in a sorted manner --- pyramid/scripts/pcreate.py | 14 +++++--------- pyramid/tests/test_scripts/test_pcreate.py | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index 881aacac3..1e8074fc5 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -8,11 +8,7 @@ import os.path import pkg_resources import re import sys - -if sys.version_info[0] == 3: - user_input = input # pragma: no cover -else: - user_input = raw_input # NOQA +from pyramid.compat import input_ _bad_chars_re = re.compile('[^a-zA-Z0-9_]') @@ -61,7 +57,7 @@ class PCreateCommand(object): dest='interactive', action='store_true', help='When a file would be overwritten, interrogate') - parser.add_option('--force-conflicting-name', + parser.add_option('--ignore-conflicting-name', dest='force_bad_name', action='store_true', default=False, @@ -181,7 +177,7 @@ class PCreateCommand(object): available = [x.name for x in self.scaffolds] diff = set(self.options.scaffold_name).difference(available) if diff: - self.out('Unavailable scaffolds: %s' % ", ".join(list(diff))) + self.out('Unavailable scaffolds: %s' % ", ".join(sorted(diff))) return False pkg_name = self.project_vars['package'] @@ -204,12 +200,12 @@ class PCreateCommand(object): if self.options.force_bad_name: return True - self.out('Package "{0}" already exists, are you sure you want ' + self.out('A package named "{0}" already exists, are you sure you want ' 'to use it as your project\'s name?'.format(pkg_name)) return self.confirm_bad_name('Really use "{0}"?: '.format(pkg_name)) def confirm_bad_name(self, prompt): # pragma: no cover - answer = user_input('{0} [y|N]: '.format(prompt)) + answer = input_('{0} [y|N]: '.format(prompt)) return answer.strip().lower() == 'y' if __name__ == '__main__': # pragma: no cover diff --git a/pyramid/tests/test_scripts/test_pcreate.py b/pyramid/tests/test_scripts/test_pcreate.py index 8fc9c1267..eaa7c1464 100644 --- a/pyramid/tests/test_scripts/test_pcreate.py +++ b/pyramid/tests/test_scripts/test_pcreate.py @@ -240,7 +240,7 @@ class TestPCreateCommand(unittest.TestCase): 'pyramid_docs_branch': 'master'}) def test_force_override_conflicting_name(self): - cmd = self._makeOne('-s', 'dummy', 'Unittest', '--force-conflicting-name') + cmd = self._makeOne('-s', 'dummy', 'Unittest', '--ignore-conflicting-name') scaffold = DummyScaffold('dummy') cmd.scaffolds = [scaffold] cmd.pyramid_dist = DummyDist("0.10.1dev") -- cgit v1.2.3 From f827882a98881c81794ceebe22c63c98f140145a Mon Sep 17 00:00:00 2001 From: Igor Stroh Date: Thu, 11 Jun 2015 00:49:06 +0200 Subject: added appropriate contributors and changes entries --- CHANGES.txt | 6 ++++++ CONTRIBUTORS.txt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 87e9f1f3a..9ed486b26 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,12 @@ Features -------- +- pcreate will now ask for confirmation if invoked with + an argument for a project name that already exists or + is importable in the current environment. + See https://github.com/Pylons/pyramid/issues/1357 and + https://github.com/Pylons/pyramid/pull/1837 + - Make it possible to subclass ``pyramid.request.Request`` and also use ``pyramid.request.Request.add_request.method``. See https://github.com/Pylons/pyramid/issues/1529 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 8eadbeecf..3405612ef 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -248,3 +248,5 @@ Contributors - Donald Stufft, 2015/03/15 - Karen Dalton, 2015/06/01 + +- Igor Stroh, 2015/06/10 -- cgit v1.2.3 From b5096d71dc30839474f390b488440cc589da5879 Mon Sep 17 00:00:00 2001 From: orangieboot Date: Thu, 11 Jun 2015 21:56:31 +0100 Subject: Update authorization.rst Removed extra colons --- docs/tutorials/wiki2/authorization.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst index d2ad7a9ca..1d810b05b 100644 --- a/docs/tutorials/wiki2/authorization.rst +++ b/docs/tutorials/wiki2/authorization.rst @@ -5,12 +5,12 @@ Adding authorization ==================== :app:`Pyramid` provides facilities for :term:`authentication` and -::term:`authorization`. We'll make use of both features to provide security -:to our application. Our application currently allows anyone with access to -:the server to view, edit, and add pages to our wiki. We'll change that to -:allow only people who are members of a *group* named ``group:editors`` to add -:and edit wiki pages but we'll continue allowing anyone with access to the -:server to view pages. +:term:`authorization`. We'll make use of both features to provide security +to our application. Our application currently allows anyone with access to +the server to view, edit, and add pages to our wiki. We'll change that to +allow only people who are members of a *group* named ``group:editors`` to add +and edit wiki pages but we'll continue allowing anyone with access to the +server to view pages. We will also add a login page and a logout link on all the pages. The login page will be shown when a user is denied access to any of the views that -- cgit v1.2.3 From 24c406cbab40285a9fa13285714f450830d5a674 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Thu, 18 Jun 2015 01:02:07 -0700 Subject: combine extra credit sections --- docs/quick_tutorial/ini.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst index 4e062e575..36942c767 100644 --- a/docs/quick_tutorial/ini.rst +++ b/docs/quick_tutorial/ini.rst @@ -131,6 +131,8 @@ Extra Credit #. The entry point in ``setup.py`` didn't mention ``__init__.py`` when it declared ``tutorial:main`` function. Why not? +#. What is the purpose of ``**settings``? What does the ``**`` signify? + .. seealso:: :ref:`project_narr`, :ref:`scaffolding_chapter`, @@ -138,7 +140,3 @@ Extra Credit :ref:`environment_chapter`, :ref:`paste_chapter` -Extra Credit -============ - -#. What is the purpose of ``**settings``? What does the ``**`` signify? -- cgit v1.2.3 From ced8b4d6fc138e11d97f85ccb88ed619f50fdc0d Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Thu, 18 Jun 2015 04:30:28 -0700 Subject: rst numbering syntax --- docs/quick_tutorial/debugtoolbar.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst index a5623ae2a..f11abc493 100644 --- a/docs/quick_tutorial/debugtoolbar.rst +++ b/docs/quick_tutorial/debugtoolbar.rst @@ -89,24 +89,24 @@ temporarily. Extra Credit ============ -# Why don't we add ``pyramid_debugtoolbar`` to the list of - ``install_requires`` dependencies in ``debugtoolbar/setup.py``? +#. Why don't we add ``pyramid_debugtoolbar`` to the list of + ``install_requires`` dependencies in ``debugtoolbar/setup.py``? -# Introduce a bug into your application: Change: +#. Introduce a bug into your application: Change: - .. code-block:: python + .. code-block:: python - def hello_world(request): - return Response('

Hello World!

') + def hello_world(request): + return Response('

Hello World!

') - to: + to: - .. code-block:: python + .. code-block:: python def hello_world(request): return xResponse('

Hello World!

') - Save, and visit http://localhost:6543/ again. Notice the nice - traceback display. On the lowest line, click the "screen" icon to the - right, and try typing the variable names ``request`` and ``Response``. - What else can you discover? + Save, and visit http://localhost:6543/ again. Notice the nice + traceback display. On the lowest line, click the "screen" icon to the + right, and try typing the variable names ``request`` and ``Response``. + What else can you discover? -- cgit v1.2.3