From 08bf6fa20e9593c14f5870f392cf7d01665f52f8 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Fri, 27 Sep 2013 23:52:20 -0600 Subject: Add note about C extensions There was some confusion regarding the output of easy_install pyramid when the Python header files were not installed, these errors are harmless however adding a simple note would have stopped a lot of frustration. --- docs/narr/install.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/narr/install.rst b/docs/narr/install.rst index fb67b899b..6260c36f2 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -25,6 +25,10 @@ on :term:`PyPy` (1.9+). :app:`Pyramid` installation does not require the compilation of any C code, so you need only a Python interpreter that meets the requirements mentioned. +Certain :app:`Pyramid` dependencies can optionally use C Python extensions, +if a compiler or Python headers are unavailable the dependency will fall back +to using pure Python instead. + For Mac OS X Users ~~~~~~~~~~~~~~~~~~ @@ -292,6 +296,13 @@ itself using the following commands: The ``easy_install`` command will take longer than the previous ones to complete, as it downloads and installs a number of dependencies. +.. note:: + + If you see any errors related to failing to compile the C extensions, you + may safely ignore those errors. If you wish to use the C extensions, please + verify that you have a functioning compiler and the Python header files + installed. + .. index:: single: installing on Windows -- cgit v1.2.3 From 994261c9104c174624fb7655508acad453023a5b Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 28 Sep 2013 01:23:43 -0500 Subject: minor tweaks to language --- docs/narr/install.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/narr/install.rst b/docs/narr/install.rst index 6260c36f2..f3f736df6 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -25,9 +25,9 @@ on :term:`PyPy` (1.9+). :app:`Pyramid` installation does not require the compilation of any C code, so you need only a Python interpreter that meets the requirements mentioned. -Certain :app:`Pyramid` dependencies can optionally use C Python extensions, -if a compiler or Python headers are unavailable the dependency will fall back -to using pure Python instead. +Some :app:`Pyramid` dependencies may attempt to build C extensions for +performance speedups. If a compiler or Python headers are unavailable the +dependency will fall back to using pure Python instead. For Mac OS X Users ~~~~~~~~~~~~~~~~~~ @@ -298,10 +298,10 @@ complete, as it downloads and installs a number of dependencies. .. note:: - If you see any errors related to failing to compile the C extensions, you - may safely ignore those errors. If you wish to use the C extensions, please - verify that you have a functioning compiler and the Python header files - installed. + If you see any warnings and/or errors related to failing to compile the C + extensions, in most cases you may safely ignore those errors. If you wish + to use the C extensions, please verify that you have a functioning compiler + and the Python header files installed. .. index:: single: installing on Windows -- cgit v1.2.3 From a8cb0406c3096486dd66204aa144cb117dab0890 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Sat, 28 Sep 2013 09:59:09 +0300 Subject: OCD: add back missing ) --- docs/quick_tour.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index 434dbdad5..1ac5181f3 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -17,7 +17,7 @@ Pyramid is a breeze. Unfortunately "standard" is not so simple in Python. For this Quick Tour, it means: `Python `_, a `virtual environment `_ -(or `virtualenv for Python 2.7 `_, +(or `virtualenv for Python 2.7 `_), and `setuptools `_. As an example, for Python 3.3+ on Linux: -- cgit v1.2.3 From 2323103debf8487d0a0a1ec27580e502d46989e3 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 28 Sep 2013 02:19:27 -0700 Subject: Add versioning to branch master --- docs/narr/install.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/narr/install.rst b/docs/narr/install.rst index f3f736df6..e419a8b20 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -289,9 +289,9 @@ Installing :app:`Pyramid` Into the Virtual Python Environment After you've got your virtualenv installed, you may install :app:`Pyramid` itself using the following commands: -.. code-block:: text - - $ $VENV/bin/easy_install pyramid +.. parsed-literal:: + + $ $VENV/bin/easy_install "pyramid==\ |release|\ " The ``easy_install`` command will take longer than the previous ones to complete, as it downloads and installs a number of dependencies. @@ -368,9 +368,9 @@ You can use Pyramid on Windows under Python 2 or 3. #. Use ``easy_install`` to get :app:`Pyramid` and its direct dependencies installed: - .. code-block:: text - - c:\env> %VENV%\Scripts\easy_install pyramid + .. parsed-literal:: + + c:\\env> %VENV%\\Scripts\\easy_install "pyramid==\ |release|\ " What Gets Installed ------------------- -- cgit v1.2.3 From 0e142c07da354d858e455c576a625c48559c3353 Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Sat, 28 Sep 2013 12:13:45 -0400 Subject: Used a parsed-literal to pin the version number on easy_install. --- docs/quick_tour/jinja2/hello_world.jinja2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/quick_tour/jinja2/hello_world.jinja2 b/docs/quick_tour/jinja2/hello_world.jinja2 index e177744b5..7a902dd3a 100644 --- a/docs/quick_tour/jinja2/hello_world.jinja2 +++ b/docs/quick_tour/jinja2/hello_world.jinja2 @@ -1,4 +1,5 @@ - + + Hello World -- cgit v1.2.3 From ebca905c2a2e1e796f3840baaf154a6d9d695cc4 Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Sat, 28 Sep 2013 12:14:13 -0400 Subject: Used a parsed-literal to pin the version number on easy_install. --- docs/quick_tour.rst | 14 +++++++------- docs/quick_tutorial/requirements.rst | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index 1ac5181f3..98584e608 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -22,21 +22,21 @@ and `setuptools `_. As an example, for Python 3.3+ on Linux: -.. code-block:: bash +.. parsed-literal:: $ pyvenv env33 $ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | env33/bin/python - $ env33/bin/easy_install pyramid + $ env33/bin/easy_install "pyramid==\ |release|\ " For Windows: -.. code-block:: posh +.. parsed-literal:: # Use your browser to download: # https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py - c:\> c:\Python33\python -m venv env33 - c:\> env33\Scripts\python ez_setup.py - c:\> env33\Scripts\easy_install pyramid + c:\\> c:\\Python33\\python -m venv env33 + c:\\> env33\\Scripts\\python ez_setup.py + c:\\> env33\\Scripts\\easy_install "pyramid==\ |release|\ " Of course Pyramid runs fine on Python 2.6+, as do the examples in this *Quick Tour*. We're just showing Python 3 a little love (Pyramid had @@ -297,7 +297,7 @@ The only change in our view...point the renderer at the ``.jinja2`` file: Our Jinja2 template is very similar to our previous template: .. literalinclude:: quick_tour/jinja2/hello_world.jinja2 - :language: jinja + :language: html Pyramid's templating add-ons register a new kind of renderer into your application. The renderer registration maps to different kinds of diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst index df63ff912..40e818807 100644 --- a/docs/quick_tutorial/requirements.rst +++ b/docs/quick_tutorial/requirements.rst @@ -94,23 +94,23 @@ and where our virtual environment will reside: Final directory structure. -The commands to do so are as follows: +For Linux, the commands to do so are as follows: .. code-block:: bash # Mac and Linux $ cd ~ - $ mkdir projects - $ cd projects - $ mkdir quick_tutorial - $ cd quick_tutorial + $ mkdir -p projects/quick_tutorial + $ cd projects/quick_tutorial + +For Windows: + +.. code-block:: posh # Windows c:\> cd \ - c:\> mkdir projects - c:\> cd projects - c:\> mkdir quick_tutorial - c:\> cd quick_tutorial + c:\> mkdir projects\quick_tutorial + c:\> cd projects\quick_tutorial In the above figure, your user home directory is represented by ``~``. In your home directory, all of your projects are in the ``projects`` directory. @@ -208,13 +208,13 @@ Install Pyramid We have our Python standard prerequisites out of the way. The Pyramid part is pretty easy: -.. code-block:: bash +.. parsed-literal:: # Mac and Linux - $ $VENV/bin/easy_install pyramid + $ $VENV/bin/easy_install "pyramid==\ |release|\ " # Windows - c:\> %VENV%\Scripts\easy_install pyramid + c:\\> %VENV%\\Scripts\\easy_install "pyramid==\ |release|\ " Our Python virtual environment now has the Pyramid software available. -- cgit v1.2.3 From 84ae800468544650c4a2eaa01a3ac805dafba480 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Mon, 30 Sep 2013 21:35:13 -0500 Subject: CONTRIBUTORS: Add Karl O. Pinc. --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 1a5b975d7..bfe22e540 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -222,3 +222,5 @@ Contributors - Takahiro Fujiwara, 2013/08/28 - Doug Hellmann, 2013/09/06 + +- Karl O. Pinc, 2013/09/27 -- cgit v1.2.3 From bc3de3f5499e39e67e29b6678503f3a14be0b08c Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 1 Oct 2013 00:14:12 -0500 Subject: Docs: project.rst: Match parenthesis & fix punctuation. --- docs/narr/project.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 602f15fef..fc3cac009 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -974,9 +974,9 @@ named ``views`` instead of within a single ``views.py`` file, you might: - *Move* the existing ``views.py`` file to a file inside the new ``views`` directory named, say, ``blog.py``. -- Create a file within the new ``views`` directory named ``__init__.py`` (it - can be empty, this just tells Python that the ``views`` directory is a - *package*. +- Create a file within the new ``views`` directory named ``__init__.py``. (It + can be empty. This just tells Python that the ``views`` directory is a + *package*.) You can then continue to add view callable functions to the ``blog.py`` module, but you can also add other ``.py`` files which contain view callable -- cgit v1.2.3 From 128d9d6cd92ddd50dfcdf14b12cc94a0902c0df1 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 1 Oct 2013 00:22:20 -0500 Subject: Docs: project.rst: Note that asset specs must be fully qualifed when moving views into a sub-package. --- docs/narr/project.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/narr/project.rst b/docs/narr/project.rst index fc3cac009..1b98271fb 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -971,13 +971,16 @@ named ``views`` instead of within a single ``views.py`` file, you might: - Create a ``views`` directory inside your ``myproject`` package directory (the same directory which holds ``views.py``). -- *Move* the existing ``views.py`` file to a file inside the new ``views`` - directory named, say, ``blog.py``. - - Create a file within the new ``views`` directory named ``__init__.py``. (It can be empty. This just tells Python that the ``views`` directory is a *package*.) +- *Move* the existing ``views.py`` file to a file inside the new ``views`` + directory named, say, ``blog.py``. The template :term:`asset + specification`s in ``blog.py`` must now be fully qualified with the + project's package name (``myproject:templates/blog.pt``) since the + ``templates`` directory remains in the ``myproject`` package. + You can then continue to add view callable functions to the ``blog.py`` module, but you can also add other ``.py`` files which contain view callable functions to the ``views`` directory. As long as you use the -- cgit v1.2.3 From ac7d1752e071fb7dadbfbf7f4bd1efadd3052b4f Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 1 Oct 2013 00:44:16 -0500 Subject: Docs: project.rst: Make the sentence more better. --- docs/narr/project.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 1b98271fb..e5da3b5c5 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -976,10 +976,10 @@ named ``views`` instead of within a single ``views.py`` file, you might: *package*.) - *Move* the existing ``views.py`` file to a file inside the new ``views`` - directory named, say, ``blog.py``. The template :term:`asset + directory named, say, ``blog.py``. Because the ``templates`` directory + remains in the ``myproject`` package the template :term:`asset specification`s in ``blog.py`` must now be fully qualified with the - project's package name (``myproject:templates/blog.pt``) since the - ``templates`` directory remains in the ``myproject`` package. + project's package name (``myproject:templates/blog.pt``). You can then continue to add view callable functions to the ``blog.py`` module, but you can also add other ``.py`` files which contain view callable -- cgit v1.2.3 From 1a76ed41b133ea73c7d40997c6f564fd72d7273e Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 1 Oct 2013 00:48:53 -0700 Subject: Add comma --- docs/narr/project.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/narr/project.rst b/docs/narr/project.rst index e5da3b5c5..4c19982d6 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -144,7 +144,7 @@ contains no space characters, so it's wise to *avoid* a path that contains i.e. ``My Documents``. As a result, the author, when he uses Windows, just puts his projects in ``C:\projects``. -.. warning:: +.. warning:: You’ll need to avoid using ``pcreate`` to create a project with the same name as a Python standard library component. In particular, this means you @@ -977,7 +977,7 @@ named ``views`` instead of within a single ``views.py`` file, you might: - *Move* the existing ``views.py`` file to a file inside the new ``views`` directory named, say, ``blog.py``. Because the ``templates`` directory - remains in the ``myproject`` package the template :term:`asset + remains in the ``myproject`` package, the template :term:`asset specification`s in ``blog.py`` must now be fully qualified with the project's package name (``myproject:templates/blog.pt``). @@ -1028,7 +1028,7 @@ server. Waitress is a server that is suited for development and light production usage. It's not the fastest nor the most featureful WSGI server. Instead, its main feature is that it works on all platforms that Pyramid needs to run on, making it a good choice as a default server from the -perspective of Pyramid's developers. +perspective of Pyramid's developers. Any WSGI server is capable of running a :app:`Pyramid` application. But we suggest you stick with the default server for development, and that you wait -- cgit v1.2.3 From fd078969a105d421f9e07aad9a7a720e2f5f2900 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 1 Oct 2013 10:53:41 -0400 Subject: remove unused files --- .../scaffolds/alchemy/+package+/static/pyramid-small.png | Bin 7044 -> 0 bytes .../scaffolds/starter/+package+/static/pyramid-small.png | Bin 7044 -> 0 bytes .../scaffolds/zodb/+package+/static/pyramid-small.png | Bin 7044 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pyramid/scaffolds/alchemy/+package+/static/pyramid-small.png delete mode 100644 pyramid/scaffolds/starter/+package+/static/pyramid-small.png delete mode 100644 pyramid/scaffolds/zodb/+package+/static/pyramid-small.png diff --git a/pyramid/scaffolds/alchemy/+package+/static/pyramid-small.png b/pyramid/scaffolds/alchemy/+package+/static/pyramid-small.png deleted file mode 100644 index a5bc0ade7..000000000 Binary files a/pyramid/scaffolds/alchemy/+package+/static/pyramid-small.png and /dev/null differ diff --git a/pyramid/scaffolds/starter/+package+/static/pyramid-small.png b/pyramid/scaffolds/starter/+package+/static/pyramid-small.png deleted file mode 100644 index a5bc0ade7..000000000 Binary files a/pyramid/scaffolds/starter/+package+/static/pyramid-small.png and /dev/null differ diff --git a/pyramid/scaffolds/zodb/+package+/static/pyramid-small.png b/pyramid/scaffolds/zodb/+package+/static/pyramid-small.png deleted file mode 100644 index a5bc0ade7..000000000 Binary files a/pyramid/scaffolds/zodb/+package+/static/pyramid-small.png and /dev/null differ -- cgit v1.2.3 From 073e5247f4adf68fe96423d6669b437dc6f337a8 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 1 Oct 2013 21:43:36 -0400 Subject: - Fix the ``pcreate`` script so that when the target directory name ends with a slash it does not produce a non-working project directory structure. Previously saying ``pcreate -s starter /foo/bar/`` produced different output than saying ``pcreate -s starter /foo/bar``. The former did not work properly. --- CHANGES.txt | 9 +++++++++ pyramid/scripts/pcreate.py | 2 +- pyramid/tests/test_scripts/test_pcreate.py | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8b2210a99..34e722fd6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,15 @@ Unreleased ========== +Bug Fixes +--------- + +- Fix the ``pcreate`` script so that when the target directory name ends with a + slash it does not produce a non-working project directory structure. + Previously saying ``pcreate -s starter /foo/bar/`` produced different output + than saying ``pcreate -s starter /foo/bar``. The former did not work + properly. + Documentation ------------- diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index ba4eb0856..5e2240856 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -77,8 +77,8 @@ class PCreateCommand(object): def render_scaffolds(self): options = self.options args = self.args - project_name = os.path.basename(args[0]) output_dir = os.path.abspath(os.path.normpath(args[0])) + project_name = os.path.basename(os.path.split(output_dir)[1]) pkg_name = _bad_chars_re.sub('', project_name.lower()) safe_name = pkg_resources.safe_name(project_name) egg_name = pkg_resources.to_filename(safe_name) diff --git a/pyramid/tests/test_scripts/test_pcreate.py b/pyramid/tests/test_scripts/test_pcreate.py index 1406d3911..6516ac229 100644 --- a/pyramid/tests/test_scripts/test_pcreate.py +++ b/pyramid/tests/test_scripts/test_pcreate.py @@ -110,6 +110,21 @@ class TestPCreateCommand(unittest.TestCase): scaffold2.vars, {'project': 'Distro', 'egg': 'Distro', 'package': 'distro'}) + def test_known_scaffold_with_path_as_project_target_rendered(self): + import os + cmd = self._makeOne('-s', 'dummy', '/tmp/foo/Distro/') + scaffold = DummyScaffold('dummy') + cmd.scaffolds = [scaffold] + result = cmd.run() + self.assertEqual(result, 0) + self.assertEqual( + scaffold.output_dir, + os.path.normpath(os.path.join(os.getcwd(), '/tmp/foo/Distro')) + ) + self.assertEqual( + scaffold.vars, + {'project': 'Distro', 'egg': 'Distro', 'package': 'distro'}) + class Test_main(unittest.TestCase): def _callFUT(self, argv): from pyramid.scripts.pcreate import main -- cgit v1.2.3 From 678f49d2e08b128785e32ed6fc9e12df4713ad7c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 1 Oct 2013 22:10:36 -0400 Subject: - Fix the ``principals_allowed_by_permission`` method of ``ACLAuthorizationPolicy`` so it anticipates a callable ``__acl__`` on resources. Previously it did not try to call the ``__acl__`` if it was callable. --- CHANGES.txt | 5 +++++ pyramid/authorization.py | 3 +++ pyramid/tests/test_authorization.py | 13 +++++++++++++ 3 files changed, 21 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 34e722fd6..880f7a3f3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,6 +10,11 @@ Bug Fixes than saying ``pcreate -s starter /foo/bar``. The former did not work properly. +- Fix the ``principals_allowed_by_permission`` method of + ``ACLAuthorizationPolicy`` so it anticipates a callable ``__acl__`` + on resources. Previously it did not try to call the ``__acl__`` + if it was callable. + Documentation ------------- diff --git a/pyramid/authorization.py b/pyramid/authorization.py index 1fd05e244..5e7baa19d 100644 --- a/pyramid/authorization.py +++ b/pyramid/authorization.py @@ -122,6 +122,9 @@ class ACLAuthorizationPolicy(object): allowed_here = set() denied_here = set() + if acl and callable(acl): + acl = acl() + for ace_action, ace_principal, ace_permissions in acl: if not is_nonstr_iter(ace_permissions): ace_permissions = [ace_permissions] diff --git a/pyramid/tests/test_authorization.py b/pyramid/tests/test_authorization.py index 60b1b0c8d..05cd3b4f8 100644 --- a/pyramid/tests/test_authorization.py +++ b/pyramid/tests/test_authorization.py @@ -146,6 +146,19 @@ class TestACLAuthorizationPolicy(unittest.TestCase): policy.principals_allowed_by_permission(context, 'read')) self.assertEqual(result, ['chrism']) + def test_principals_allowed_by_permission_callable_acl(self): + from pyramid.security import Allow + from pyramid.security import DENY_ALL + context = DummyContext() + acl = lambda: [ (Allow, 'chrism', ('read', 'write')), + DENY_ALL, + (Allow, 'other', 'read') ] + context.__acl__ = acl + policy = self._makeOne() + result = sorted( + policy.principals_allowed_by_permission(context, 'read')) + self.assertEqual(result, ['chrism']) + def test_principals_allowed_by_permission_string_permission(self): from pyramid.security import Allow context = DummyContext() -- cgit v1.2.3