From 6a9a6cc89b86e829b792161f8b0f49284e0b5e27 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Fri, 15 Feb 2013 08:37:03 +0200 Subject: Update to latest v2 bootstrap Downloaded from http://downloads.buildout.org/2/bootstrap.py --- bootstrap.py | 186 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 116 insertions(+), 70 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index a6da5d3..ec3757a 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -18,102 +18,148 @@ The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. """ -import os, shutil, sys, tempfile, urllib2 +import os, shutil, sys, tempfile from optparse import OptionParser tmpeggs = tempfile.mkdtemp() -is_jython = sys.platform.startswith('java') +usage = '''\ +[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] -# parsing arguments -parser = OptionParser() -parser.add_option("-v", "--version", dest="version", - help="use a specific zc.buildout version") -parser.add_option("-d", "--distribute", - action="store_true", dest="distribute", default=False, - help="Use Disribute rather than Setuptools.") +Bootstraps a buildout-based project. -parser.add_option("-c", None, action="store", dest="config_file", +Simply run this script in a directory containing a buildout.cfg, using the +Python that you want bin/buildout to use. + +Note that by using --setup-source and --download-base to point to +local resources, you can keep this script from going over the network. +''' + +parser = OptionParser(usage=usage) +parser.add_option("-v", "--version", help="use a specific zc.buildout version") + +parser.add_option("-t", "--accept-buildout-test-releases", + dest='accept_buildout_test_releases', + action="store_true", default=False, + help=("Normally, if you do not specify a --version, the " + "bootstrap script and buildout gets the newest " + "*final* versions of zc.buildout and its recipes and " + "extensions for you. If you use this flag, " + "bootstrap and buildout will get the newest releases " + "even if they are alphas or betas.")) +parser.add_option("-c", "--config-file", help=("Specify the path to the buildout configuration " "file to be used.")) +parser.add_option("-f", "--find-links", + help=("Specify a URL to search for buildout releases")) -options, args = parser.parse_args() - -# if -c was provided, we push it back into args for buildout' main function -if options.config_file is not None: - args += ['-c', options.config_file] -if options.version is not None: - VERSION = '==%s' % options.version -else: - VERSION = '' +options, args = parser.parse_args() -USE_DISTRIBUTE = options.distribute -args = args + ['bootstrap'] +###################################################################### +# load/install distribute to_reload = False try: - import pkg_resources + import pkg_resources, setuptools if not hasattr(pkg_resources, '_distribute'): to_reload = True raise ImportError except ImportError: ez = {} - if USE_DISTRIBUTE: - exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py' - ).read() in ez - ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True) - else: - exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' - ).read() in ez - ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) + + try: + from urllib.request import urlopen + except ImportError: + from urllib2 import urlopen + + exec(urlopen('http://python-distribute.org/distribute_setup.py').read(), ez) + setup_args = dict(to_dir=tmpeggs, download_delay=0, no_fake=True) + ez['use_setuptools'](**setup_args) if to_reload: reload(pkg_resources) - else: - import pkg_resources - -if sys.platform == 'win32': - def quote(c): - if ' ' in c: - return '"%s"' % c # work around spawn lamosity on windows - else: - return c -else: - def quote (c): - return c - -cmd = 'from setuptools.command.easy_install import main; main()' + import pkg_resources + # This does not (always?) update the default working set. We will + # do it. + for path in sys.path: + if path not in pkg_resources.working_set.entries: + pkg_resources.working_set.add_entry(path) + +###################################################################### +# Install buildout + ws = pkg_resources.working_set -if USE_DISTRIBUTE: - requirement = 'distribute' -else: - requirement = 'setuptools' - -if is_jython: - import subprocess - - assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd', - quote(tmpeggs), 'zc.buildout' + VERSION], - env=dict(os.environ, - PYTHONPATH= - ws.find(pkg_resources.Requirement.parse(requirement)).location - ), - ).wait() == 0 - -else: - assert os.spawnle( - os.P_WAIT, sys.executable, quote (sys.executable), - '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION, - dict(os.environ, - PYTHONPATH= - ws.find(pkg_resources.Requirement.parse(requirement)).location - ), - ) == 0 +cmd = [sys.executable, '-c', + 'from setuptools.command.easy_install import main; main()', + '-mZqNxd', tmpeggs] + +find_links = os.environ.get( + 'bootstrap-testing-find-links', + options.find_links or + ('http://downloads.buildout.org/' + if options.accept_buildout_test_releases else None) + ) +if find_links: + cmd.extend(['-f', find_links]) + +distribute_path = ws.find( + pkg_resources.Requirement.parse('distribute')).location + +requirement = 'zc.buildout' +version = options.version +if version is None and not options.accept_buildout_test_releases: + # Figure out the most recent final version of zc.buildout. + import setuptools.package_index + _final_parts = '*final-', '*final' + def _final_version(parsed_version): + for part in parsed_version: + if (part[:1] == '*') and (part not in _final_parts): + return False + return True + index = setuptools.package_index.PackageIndex( + search_path=[distribute_path]) + if find_links: + index.add_find_links((find_links,)) + req = pkg_resources.Requirement.parse(requirement) + if index.obtain(req) is not None: + best = [] + bestv = None + for dist in index[req.project_name]: + distv = dist.parsed_version + if _final_version(distv): + if bestv is None or distv > bestv: + best = [dist] + bestv = distv + elif distv == bestv: + best.append(dist) + if best: + best.sort() + version = best[-1].version +if version: + requirement = '=='.join((requirement, version)) +cmd.append(requirement) + +import subprocess +if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=distribute_path)) != 0: + raise Exception( + "Failed to execute command:\n%s", + repr(cmd)[1:-1]) + +###################################################################### +# Import and run buildout ws.add_entry(tmpeggs) -ws.require('zc.buildout' + VERSION) +ws.require(requirement) import zc.buildout.buildout + +if not [a for a in args if '=' not in a]: + args.append('bootstrap') + +# if -c was provided, we push it back into args for buildout' main function +if options.config_file is not None: + args[0:0] = ['-c', options.config_file] + zc.buildout.buildout.main(args) shutil.rmtree(tmpeggs) -- cgit v1.2.1 From 25fc9b2e2b6d78188132f5e3c5db2eeff6f20c7c Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Fri, 15 Feb 2013 08:37:37 +0200 Subject: Fix nondeterministic test failures This fixes three test failures I've seen on Python 3.3: test_allow_w_single_interface test_require_w_set_schema_normal_fields test_require_w_single_interface All caused by dictionary iteration returning items in a different order than the test expected. --- src/zope/security/metaconfigure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zope/security/metaconfigure.py b/src/zope/security/metaconfigure.py index 54484ac..e2dd0a0 100644 --- a/src/zope/security/metaconfigure.py +++ b/src/zope/security/metaconfigure.py @@ -109,7 +109,7 @@ class ClassDirective(object): def __protectByInterface(self, interface, permission_id): "Set a permission on names in an interface." - for n, d in interface.namesAndDescriptions(1): + for n, d in sorted(interface.namesAndDescriptions(1)): self.__protectName(n, permission_id) self.__context.action( discriminator = None, @@ -143,7 +143,7 @@ class ClassDirective(object): def __protectSetSchema(self, schema, permission_id): "Set a permission on a bunch of names." _context = self.__context - for name in schema: + for name in sorted(schema): field = schema[name] if IField.providedBy(field) and not field.readonly: _context.action( -- cgit v1.2.1 From afd7d5841e12fac37289e3d00eb9ac83d2f5a5b6 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 15 Feb 2013 11:38:25 -0500 Subject: Restore deprecated BBB imports of z.s.untrustedpython modules. --- src/zope/security/untrustedpython/__init__.py | 17 +++++++++++++++++ src/zope/security/untrustedpython/builtins.py | 18 ++++++++++++++++++ src/zope/security/untrustedpython/interpreter.py | 18 ++++++++++++++++++ src/zope/security/untrustedpython/rcompile.py | 18 ++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 src/zope/security/untrustedpython/__init__.py create mode 100644 src/zope/security/untrustedpython/builtins.py create mode 100644 src/zope/security/untrustedpython/interpreter.py create mode 100644 src/zope/security/untrustedpython/rcompile.py diff --git a/src/zope/security/untrustedpython/__init__.py b/src/zope/security/untrustedpython/__init__.py new file mode 100644 index 0000000..47c6918 --- /dev/null +++ b/src/zope/security/untrustedpython/__init__.py @@ -0,0 +1,17 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +from zope.deprecation import moved + +moved('zope.untrustedpython', '4.1') +del moved diff --git a/src/zope/security/untrustedpython/builtins.py b/src/zope/security/untrustedpython/builtins.py new file mode 100644 index 0000000..4485831 --- /dev/null +++ b/src/zope/security/untrustedpython/builtins.py @@ -0,0 +1,18 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +from zope.deprecation import moved +moved('zope.untrustedpython.builtins', '4.1') +del moved + +from zope.untrustedpython.builtins import * diff --git a/src/zope/security/untrustedpython/interpreter.py b/src/zope/security/untrustedpython/interpreter.py new file mode 100644 index 0000000..3d07cee --- /dev/null +++ b/src/zope/security/untrustedpython/interpreter.py @@ -0,0 +1,18 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +from zope.deprecation import moved +moved('zope.untrustedpython.interpreter', '4.1') +del moved + +from zope.untrustedpython.interpreter import * diff --git a/src/zope/security/untrustedpython/rcompile.py b/src/zope/security/untrustedpython/rcompile.py new file mode 100644 index 0000000..ca88890 --- /dev/null +++ b/src/zope/security/untrustedpython/rcompile.py @@ -0,0 +1,18 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +from zope.deprecation import moved +moved('zope.untrustedpython.rcompile', '4.1') +del moved + +from zope.untrustedpython.rcompile import * -- cgit v1.2.1 From 010aafbeca43cecba292b7c4a565979002a3faa2 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 15 Feb 2013 11:39:20 -0500 Subject: Prep 4.0.0a2 release. --- CHANGES.rst | 14 ++++++-------- setup.py | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5678dbf..5fd9e86 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,16 +2,14 @@ CHANGES ======= -4.0.0 (unreleased) ------------------- - -- TODO: Add PyPy support -- TODO: add pure-Python implementations of: +4.0.0a2 (2013-02-15) +-------------------- - - ``z.s._proxy.getChecker`` - - ``z.s._proxy.getObject`` - - ``z.s._proxy._Proxy`` +- Added back the ``untrustedpython`` extra: now pulls in + ``zope.untrustedpython``. Restored deprecated backward-compatible imports + for ``zope.security.untrustedpython.{builtins,interpreter,rcompile}`` + (the extra and the imports are to be removed in version 4.1). 4.0.0a1 (2013-02-14) diff --git a/setup.py b/setup.py index ffca17f..1ac16fe 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ else: ] setup(name='zope.security', - version='4.0.0dev', + version='4.0.0a2', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', @@ -138,6 +138,7 @@ setup(name='zope.security', test=TESTS_REQUIRE, testing=TESTS_REQUIRE + ['nose', 'coverage'], docs=['Sphinx', 'repoze.sphinx.autointerface'], + untrustedpython=['zope.untrustedpython', 'zope.deprecation'], ), include_package_data = True, zip_safe = False, -- cgit v1.2.1 From a0c986776cdb5711d00dd0e3f38dd003d21ac76f Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 15 Feb 2013 11:42:43 -0500 Subject: svb --- CHANGES.rst | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5fd9e86..88a7002 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,17 @@ CHANGES ======= +4.0.0 (unreleased) +------------------ + +- TODO: Add PyPy support + +- TODO: add pure-Python implementations of: + + - ``z.s._proxy.getChecker`` + - ``z.s._proxy.getObject`` + - ``z.s._proxy._Proxy`` + 4.0.0a2 (2013-02-15) -------------------- diff --git a/setup.py b/setup.py index 1ac16fe..90d54da 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ else: ] setup(name='zope.security', - version='4.0.0a2', + version='4.0.0dev', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From 327b8008f0ef6f66c307159d457b410130e2e300 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 15 Feb 2013 12:22:55 -0500 Subject: Fix test breakage under 4.0.0a2 due to deprecation strategy. --- CHANGES.rst | 13 +++---------- setup.cfg | 1 + src/zope/security/untrustedpython/__init__.py | 8 ++++---- src/zope/security/untrustedpython/builtins.py | 12 ++++++++---- src/zope/security/untrustedpython/interpreter.py | 12 ++++++++---- src/zope/security/untrustedpython/rcompile.py | 12 ++++++++---- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 88a7002..dbb9313 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,17 +2,10 @@ CHANGES ======= -4.0.0 (unreleased) ------------------- - -- TODO: Add PyPy support - -- TODO: add pure-Python implementations of: - - - ``z.s._proxy.getChecker`` - - ``z.s._proxy.getObject`` - - ``z.s._proxy._Proxy`` +4.0.0a3 (unreleased) +-------------------- +- Fix test breakage in 4.0.0a2 due to deprecation strategy. 4.0.0a2 (2013-02-15) -------------------- diff --git a/setup.cfg b/setup.cfg index 48d6297..6ceb809 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,6 +4,7 @@ cover-package=zope.security cover-erase=1 with-doctest=0 where=src +exclude=untrustedpython [aliases] dev = develop easy_install zope.security[testing] diff --git a/src/zope/security/untrustedpython/__init__.py b/src/zope/security/untrustedpython/__init__.py index 47c6918..88f81c0 100644 --- a/src/zope/security/untrustedpython/__init__.py +++ b/src/zope/security/untrustedpython/__init__.py @@ -11,7 +11,7 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -from zope.deprecation import moved - -moved('zope.untrustedpython', '4.1') -del moved +from warnings import warn +warn('Import from zope.untrustedpython. This BBB module will' + 'be removed in zope.security 4.1', DeprecationWarning, 2) +del warn diff --git a/src/zope/security/untrustedpython/builtins.py b/src/zope/security/untrustedpython/builtins.py index 4485831..6975cc7 100644 --- a/src/zope/security/untrustedpython/builtins.py +++ b/src/zope/security/untrustedpython/builtins.py @@ -11,8 +11,12 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -from zope.deprecation import moved -moved('zope.untrustedpython.builtins', '4.1') -del moved +from warnings import warn +warn('Import from zope.untrustedpython.builtins. This BBB module will' + 'be removed in zope.security 4.1', DeprecationWarning, 2) +del warn -from zope.untrustedpython.builtins import * +try: + from zope.untrustedpython.builtins import * +except ImportError: + pass diff --git a/src/zope/security/untrustedpython/interpreter.py b/src/zope/security/untrustedpython/interpreter.py index 3d07cee..5ecc36b 100644 --- a/src/zope/security/untrustedpython/interpreter.py +++ b/src/zope/security/untrustedpython/interpreter.py @@ -11,8 +11,12 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -from zope.deprecation import moved -moved('zope.untrustedpython.interpreter', '4.1') -del moved +from warnings import warn +warn('Import from zope.untrustedpython.interpreter. This BBB module will' + 'be removed in zope.security 4.1', DeprecationWarning, 2) +del warn -from zope.untrustedpython.interpreter import * +try: + from zope.untrustedpython.interpreter import * +except ImportError: + pass diff --git a/src/zope/security/untrustedpython/rcompile.py b/src/zope/security/untrustedpython/rcompile.py index ca88890..08eb018 100644 --- a/src/zope/security/untrustedpython/rcompile.py +++ b/src/zope/security/untrustedpython/rcompile.py @@ -11,8 +11,12 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -from zope.deprecation import moved -moved('zope.untrustedpython.rcompile', '4.1') -del moved +from warnings import warn +warn('Import from zope.untrustedpython.rcompile. This BBB module will' + 'be removed in zope.security 4.1', DeprecationWarning, 2) +del warn -from zope.untrustedpython.rcompile import * +try: + from zope.untrustedpython.rcompile import * +except ImportError: + pass -- cgit v1.2.1 From 7239d40098f2a72787294bf14d651876d6d7f162 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 15 Feb 2013 12:23:45 -0500 Subject: Prep 4.0.0a3 release. --- CHANGES.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index dbb9313..c8669a3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,7 +2,7 @@ CHANGES ======= -4.0.0a3 (unreleased) +4.0.0a3 (2013-02-15) -------------------- - Fix test breakage in 4.0.0a2 due to deprecation strategy. diff --git a/setup.py b/setup.py index 90d54da..b6a2748 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ else: ] setup(name='zope.security', - version='4.0.0dev', + version='4.0.0a3', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From b571eebed157c5451badee1610c2d1d11c9b6a34 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 15 Feb 2013 12:25:41 -0500 Subject: svb --- CHANGES.rst | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index c8669a3..9deb4ef 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,17 @@ CHANGES ======= +4.0.0 (unreleased) +------------------ + +- TODO: Add PyPy support + +- TODO: add pure-Python implementations of: + + - ``z.s._proxy.getChecker`` + - ``z.s._proxy.getObject`` + - ``z.s._proxy._Proxy`` + 4.0.0a3 (2013-02-15) -------------------- diff --git a/setup.py b/setup.py index b6a2748..90d54da 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ else: ] setup(name='zope.security', - version='4.0.0a3', + version='4.0.0dev', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From 18a6987860cdb622fca9c98fca22692c90fc45f8 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Sat, 16 Feb 2013 14:31:13 -0500 Subject: Fold in post-3.8.3, pre-4.0 changelog entries from release branches. --- CHANGES.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 9deb4ef..f4e81e5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -78,6 +78,24 @@ CHANGES - Added test convenience helper ``create_interaction`` and ``with interaction()``. +3.9.0 (2012-12-21) +------------------ + +- Pin ``zope.proxy >= 4.1.0`` + +- Ship with an included ``proxy.h`` header which is compatible with the + 4.1.x version ov ``zope.proxy``. + +3.8.5 (2012-12-21) +------------------ + +- Ship with an included ``proxy.h`` header which is compatible with the + supported versions of ``zope.proxy``. + +3.8.4 (2012-12-20) +------------------ + +- Pin ``zope.proxy >= 3.4.2, <4.1dev`` 3.8.3 (2011-09-24) ------------------ -- cgit v1.2.1 From e1d5f7cf375ccdfb8f6207c2bf813ca64c1d7bda Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Tue, 19 Feb 2013 09:11:10 +0200 Subject: Try to make the tests pass on Windows --- src/zope/security/tests/test_proxy.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/zope/security/tests/test_proxy.py b/src/zope/security/tests/test_proxy.py index dbf4a1d..e54894d 100644 --- a/src/zope/security/tests/test_proxy.py +++ b/src/zope/security/tests/test_proxy.py @@ -14,6 +14,7 @@ """Security proxy tests """ import unittest +import sys from zope.security._compat import PYTHON2 @@ -35,6 +36,15 @@ def _skip_if_Py2(testfunc): return dummy return testfunc +def _fmt_address(obj): + # Try to replicate PyString_FromString("%p", obj), which actually uses + # the platform sprintf(buf, "%p", obj), which we cannot access from Python + # directly (and ctypes seems like overkill). + if sys.platform == 'win32': + return '0x%08x' % id(obj) + else: + return '0x%0x' % id(obj) + class ProxyCTests(unittest.TestCase): @@ -157,9 +167,10 @@ class ProxyCTests(unittest.TestCase): target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) + address = _fmt_address(target) self.assertEqual(str(proxy), '' % (_BUILTINS, id(target))) + 'instance at %s>' % (_BUILTINS, address)) def test___repr___checker_allows_str(self): target = object() @@ -173,9 +184,10 @@ class ProxyCTests(unittest.TestCase): target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) + address = _fmt_address(target) self.assertEqual(repr(proxy), '' % (_BUILTINS, id(target))) + 'instance at %s>' % (_BUILTINS, address)) @_skip_if_not_Py2 def test___cmp___w_self(self): -- cgit v1.2.1 From ec3ec97c92703bfb7827e7c9472bcbe0f254253e Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Tue, 19 Feb 2013 11:59:47 +0200 Subject: More tests are running under python-3 Include documentation doctests into main test suite. Documentation is updated to be valid under python-3 and some critical bugs in python-3 are revealed. --- docs/api/checker.rst | 119 ++++++++++++++++++++++--------------------- docs/api/decorator.rst | 25 +++++---- docs/api/zcml.rst | 11 ++-- setup.py | 17 ++++++- src/zope/security/testing.py | 19 ++++++- tox.ini | 1 + 6 files changed, 120 insertions(+), 72 deletions(-) diff --git a/docs/api/checker.rst b/docs/api/checker.rst index 8b321db..83c347a 100644 --- a/docs/api/checker.rst +++ b/docs/api/checker.rst @@ -82,8 +82,7 @@ directly, or via interface: >>> context = AContext() >>> allow(context, attributes=['foo', 'bar'], interface=[I1, I2]) - >>> context.actions.sort( - ... lambda a, b: cmp(a['discriminator'], b['discriminator'])) + >>> context.actions.sort(key=lambda a: a['discriminator']) >>> pprint(context.actions) [{'args': ('testmodule', 'a', 'zope.Public'), 'callable': 1, @@ -136,8 +135,7 @@ directly, or via interface: >>> require(context, attributes=['foo', 'bar'], ... interface=[I1, I2], permission='p') - >>> context.actions.sort( - ... lambda a, b: cmp(a['discriminator'], b['discriminator'])) + >>> context.actions.sort(key=lambda a: a['discriminator']) >>> pprint(context.actions) [{'args': ('testmodule', 'a', 'p'), 'callable': 1, @@ -182,26 +180,26 @@ Protections for standard objects ... from zope.security.interfaces import ForbiddenAttribute ... try: ... return getattr(object, attr) - ... except ForbiddenAttribute, e: - ... return 'ForbiddenAttribute: %s' % e[0] + ... except ForbiddenAttribute as e: + ... return 'ForbiddenAttribute: %s' % e.args[0] >>> def check_forbidden_setitem(object, item, value): ... from zope.security.interfaces import ForbiddenAttribute ... try: ... object[item] = value - ... except ForbiddenAttribute, e: - ... return 'ForbiddenAttribute: %s' % e[0] + ... except ForbiddenAttribute as e: + ... return 'ForbiddenAttribute: %s' % e.args[0] >>> def check_forbidden_delitem(object, item): ... from zope.security.interfaces import ForbiddenAttribute ... try: ... del object[item] - ... except ForbiddenAttribute, e: - ... return 'ForbiddenAttribute: %s' % e[0] + ... except ForbiddenAttribute as e: + ... return 'ForbiddenAttribute: %s' % e.args[0] >>> def check_forbidden_call(callable, *args): # ** ... from zope.security.interfaces import ForbiddenAttribute ... try: ... return callable(*args) # ** - ... except ForbiddenAttribute, e: - ... return 'ForbiddenAttribute: %s' % e[0] + ... except ForbiddenAttribute as e: + ... return 'ForbiddenAttribute: %s' % e.args[0] Rocks ##### @@ -217,19 +215,25 @@ Rocks are immuatle, non-callable objects without interesting methods. They 1 >>> int(type(ProxyFactory( 1.0 )) is float) 1 - >>> int(type(ProxyFactory( 1l )) is long) - 1 >>> int(type(ProxyFactory( 1j )) is complex) 1 >>> int(type(ProxyFactory( None )) is type(None)) 1 >>> int(type(ProxyFactory( 'xxx' )) is str) 1 - >>> int(type(ProxyFactory( u'xxx' )) is unicode) - 1 >>> int(type(ProxyFactory( True )) is type(True)) 1 +Additionally, check some python-2.x specific types. + +.. doctest:: + >>> import sys + >>> PY2 = sys.version_info[0] == 2 + >>> int(type(ProxyFactory( long(1) )) is long) if PY2 else 1 + 1 + >>> int(type(ProxyFactory( u'xxx' )) is unicode) if PY2 else 1 + 1 + Datetime-reltatd instances are rocks, too: .. doctest:: @@ -270,18 +274,18 @@ We can do everything we expect to be able to do with proxied dicts. 1 >>> len(d) 2 - >>> list(d) + >>> sorted(list(d)) ['a', 'b'] >>> d.get('a') 1 - >>> int(d.has_key('a')) + >>> int('a' in d) 1 >>> c = d.copy() >>> check_forbidden_get(c, 'clear') 'ForbiddenAttribute: clear' >>> int(str(c) in ("{'a': 1, 'b': 2}", "{'b': 2, 'a': 1}")) 1 - >>> int(`c` in ("{'a': 1, 'b': 2}", "{'b': 2, 'a': 1}")) + >>> int(repr(c) in ("{'a': 1, 'b': 2}", "{'b': 2, 'a': 1}")) 1 >>> def sorted(x): ... x = list(x) @@ -293,26 +297,27 @@ We can do everything we expect to be able to do with proxied dicts. [1, 2] >>> sorted(d.items()) [('a', 1), ('b', 2)] - >>> sorted(d.iterkeys()) + >>> sorted(d.iterkeys()) if PY2 else ['a', 'b'] ['a', 'b'] - >>> sorted(d.itervalues()) + >>> sorted(d.itervalues()) if PY2 else [1, 2] [1, 2] - >>> sorted(d.iteritems()) + >>> sorted(d.iteritems()) if PY2 else [('a', 1), ('b', 2)] [('a', 1), ('b', 2)] -Always available: +Always available (note, that dicts in python-3.x are not orderable, so we are +not checking that under python > 2): .. doctest:: - >>> int(d < d) + >>> int(d < d) if PY2 else 0 0 - >>> int(d > d) + >>> int(d > d) if PY2 else 0 0 - >>> int(d <= d) + >>> int(d <= d) if PY2 else 1 1 - >>> int(d >= d) + >>> int(d >= d) if PY2 else 1 1 - >>> int(d == d) + >>> int(d == d) if PY2 else 1 1 >>> int(d != d) 0 @@ -351,7 +356,7 @@ We can do everything we expect to be able to do with proxied lists. 1 >>> str(l) '[1, 2]' - >>> `l` + >>> repr(l) '[1, 2]' >>> l + l [1, 2, 1, 2] @@ -398,7 +403,7 @@ We can do everything we expect to be able to do with proxied tuples. 1 >>> str(l) '(1, 2)' - >>> `l` + >>> repr(l) '(1, 2)' >>> l + l (1, 2, 1, 2) @@ -607,8 +612,8 @@ we can do everything we expect to be able to do with proxied frozensets. ... from zope.security.interfaces import ForbiddenAttribute ... try: ... return getattr(object, attr) - ... except ForbiddenAttribute, e: - ... return 'ForbiddenAttribute: %s' % e[0] + ... except ForbiddenAttribute as e: + ... return 'ForbiddenAttribute: %s' % e.args[0] >>> from zope.security.checker import ProxyFactory >>> from zope.security.interfaces import ForbiddenAttribute >>> us = frozenset((1, 2)) @@ -856,7 +861,7 @@ New-style classes >>> check_forbidden_get(C, '__dict__') 'ForbiddenAttribute: __dict__' >>> s = str(C) - >>> s = `C` + >>> s = repr(C) >>> int(C.__module__ == __name__) 1 >>> len(C.__bases__) @@ -868,13 +873,13 @@ Always available: .. doctest:: - >>> int(C < C) + >>> int(C < C) if PY2 else 0 0 - >>> int(C > C) + >>> int(C > C) if PY2 else 0 0 - >>> int(C <= C) + >>> int(C <= C) if PY2 else 1 1 - >>> int(C >= C) + >>> int(C >= C) if PY2 else 1 1 >>> int(C == C) 1 @@ -907,13 +912,13 @@ Always available: .. doctest:: - >>> int(c < c) + >>> int(c < c) if PY2 else 0 0 - >>> int(c > c) + >>> int(c > c) if PY2 else 0 0 - >>> int(c <= c) + >>> int(c <= c) if PY2 else 1 1 - >>> int(c >= c) + >>> int(c >= c) if PY2 else 1 1 >>> int(c == c) 1 @@ -938,23 +943,23 @@ Classic Classes >>> check_forbidden_get(C, '__dict__') 'ForbiddenAttribute: __dict__' >>> s = str(C) - >>> s = `C` + >>> s = repr(C) >>> int(C.__module__ == __name__) 1 - >>> len(C.__bases__) + >>> len(C.__bases__) if PY2 else 0 0 Always available: .. doctest:: - >>> int(C < C) + >>> int(C < C) if PY2 else 0 0 - >>> int(C > C) + >>> int(C > C) if PY2 else 0 0 - >>> int(C <= C) + >>> int(C <= C) if PY2 else 1 1 - >>> int(C >= C) + >>> int(C >= C) if PY2 else 1 1 >>> int(C == C) 1 @@ -984,13 +989,13 @@ Always available: .. doctest:: - >>> int(c < c) + >>> int(c < c) if PY2 else 0 0 - >>> int(c > c) + >>> int(c > c) if PY2 else 0 0 - >>> int(c <= c) + >>> int(c <= c) if PY2 else 1 1 - >>> int(c >= c) + >>> int(c >= c) if PY2 else 1 1 >>> int(c == c) 1 @@ -1055,7 +1060,7 @@ We work with the ABCMeta meta class: >>> check_forbidden_get(PBar, '__dict__') 'ForbiddenAttribute: __dict__' >>> s = str(PBar) - >>> s = `PBar` + >>> s = repr(PBar) >>> int(PBar.__module__ == __name__) 1 >>> len(PBar.__bases__) @@ -1065,13 +1070,13 @@ Always available: .. doctest:: - >>> int(PBar < PBar) + >>> int(PBar < PBar) if PY2 else 0 0 - >>> int(PBar > PBar) + >>> int(PBar > PBar) if PY2 else 0 0 - >>> int(PBar <= PBar) + >>> int(PBar <= PBar) if PY2 else 1 1 - >>> int(PBar >= PBar) + >>> int(PBar >= PBar) if PY2 else 1 1 >>> int(PBar == PBar) 1 @@ -1079,5 +1084,5 @@ Always available: 0 >>> int(bool(PBar)) 1 - >>> int(PBar.__class__ == abc.ABCMeta) + >>> int(PBar.__class__ == abc.ABCMeta) if PY2 else 1 1 diff --git a/docs/api/decorator.rst b/docs/api/decorator.rst index c4741b9..c05c692 100644 --- a/docs/api/decorator.rst +++ b/docs/api/decorator.rst @@ -48,13 +48,16 @@ Using `selectChecker()`, we can confirm that a `Foo` object uses .. doctest:: >>> from zope.security.checker import selectChecker + >>> from zope.security.interfaces import ForbiddenAttribute >>> foo = Foo() >>> selectChecker(foo) is fooChecker True >>> fooChecker.check(foo, 'a') - >>> fooChecker.check(foo, 'b') # doctest: +ELLIPSIS - Traceback (most recent call last): - ForbiddenAttribute: ('b', ) + >>> try: + ... fooChecker.check(foo, 'b') # doctest: +ELLIPSIS + ... except ForbiddenAttribute as e: + ... e + ForbiddenAttribute('b', ) and that a `Wrapper` object uses `wrappeChecker`: @@ -64,9 +67,11 @@ and that a `Wrapper` object uses `wrappeChecker`: >>> selectChecker(wrapper) is wrapperChecker True >>> wrapperChecker.check(wrapper, 'b') - >>> wrapperChecker.check(wrapper, 'a') # doctest: +ELLIPSIS - Traceback (most recent call last): - ForbiddenAttribute: ('a', ) + >>> try: + ... wrapperChecker.check(wrapper, 'a') # doctest: +ELLIPSIS + ... except ForbiddenAttribute as e: + ... e + ForbiddenAttribute('a', ) (Note that the object description says `Foo` because the object is a proxy and generally looks and acts like the object it's proxying.) @@ -94,9 +99,11 @@ illustrate, we'll proxify `foo`: >>> secure_foo = ProxyFactory(foo) >>> secure_foo.a 'a' - >>> secure_foo.b # doctest: +ELLIPSIS - Traceback (most recent call last): - ForbiddenAttribute: ('b', ) + >>> try: + ... secure_foo.b # doctest: +ELLIPSIS + ... except ForbiddenAttribute as e: + ... e + ForbiddenAttribute('b', ) when we wrap the secured `foo`: diff --git a/docs/api/zcml.rst b/docs/api/zcml.rst index 5fdc3a0..7c03405 100644 --- a/docs/api/zcml.rst +++ b/docs/api/zcml.rst @@ -64,10 +64,13 @@ Now let's see whether validation works alright >>> field._validate('zope.ManageCode') >>> context._actions[0]['args'] (None, 'zope.foo') - >>> field._validate('3 foo') - Traceback (most recent call last): - ... - InvalidId: 3 foo + + >>> from zope.schema.interfaces import InvalidId + >>> try: + ... field._validate('3 foo') + ... except InvalidId as e: + ... e + InvalidId('3 foo') zope.Public is always valid >>> field._validate('zope.Public') diff --git a/setup.py b/setup.py index 90d54da..91c43d4 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,21 @@ TESTS_REQUIRE = [ 'zope.location', ] +def alltests(): + import os + import sys + import unittest + # use the zope.testrunner machinery to find all the + # test suites we've put under ourselves + import zope.testrunner.find + import zope.testrunner.options + here = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')) + args = sys.argv[:] + defaults = ["--test-path", here] + options = zope.testrunner.options.get_options(args, defaults) + suites = list(zope.testrunner.find.find_suites(options)) + return unittest.TestSuite(suites) + here = os.path.abspath(os.path.dirname(__file__)) def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() @@ -130,7 +145,7 @@ setup(name='zope.security', 'zope.proxy >= 4.1.0', 'zope.schema', ], - test_suite = 'zope.security', + test_suite = '__main__.alltests', tests_require=TESTS_REQUIRE, extras_require = dict( pytz=["pytz"], diff --git a/src/zope/security/testing.py b/src/zope/security/testing.py index 53d1ebe..ee13db8 100644 --- a/src/zope/security/testing.py +++ b/src/zope/security/testing.py @@ -15,13 +15,30 @@ This module provides some helper/stub objects for setting up interactions. """ +import sys +import re from zope import interface, component from zope.security import interfaces from zope.security.permission import Permission import contextlib import zope.security.management - +from zope.testing import renormalizing + +PY2 = sys.version_info[0] == 2 + +if PY2: + _u = unicode + rules = [(re.compile("b('.*?')"), r"\1"), + (re.compile('b(".*?")'), r"\1"), + ] + output_checker = renormalizing.RENormalizing(rules) +else: + _u = str + rules = [(re.compile("u('.*?')"), r"\1"), + (re.compile('u(".*?")'), r"\1"), + ] + output_checker = renormalizing.RENormalizing(rules) @interface.implementer(interfaces.IPrincipal) class Principal: diff --git a/tox.ini b/tox.ini index ea5bc87..8524a81 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ deps = zope.component zope.location zope.proxy + zope.testrunner commands = python setup.py test -q -- cgit v1.2.1 From 7434c4686c573946feb81dcba0a670e17013a29c Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Tue, 19 Feb 2013 16:23:24 +0200 Subject: Dictionary views are not proxied Dict views for keys(), items(), and values() are not proxied, making dicts work in python3 exactly as python2. --- docs/api/checker.rst | 79 ++++++++++++++++++++++++-------------------- src/zope/security/checker.py | 6 +++- 2 files changed, 49 insertions(+), 36 deletions(-) diff --git a/docs/api/checker.rst b/docs/api/checker.rst index 83c347a..4bf5dc7 100644 --- a/docs/api/checker.rst +++ b/docs/api/checker.rst @@ -227,11 +227,10 @@ Rocks are immuatle, non-callable objects without interesting methods. They Additionally, check some python-2.x specific types. .. doctest:: - >>> import sys - >>> PY2 = sys.version_info[0] == 2 - >>> int(type(ProxyFactory( long(1) )) is long) if PY2 else 1 + >>> from zope.security._compat import PYTHON2 + >>> int(type(ProxyFactory( long(1) )) is long) if PYTHON2 else 1 1 - >>> int(type(ProxyFactory( u'xxx' )) is unicode) if PY2 else 1 + >>> int(type(ProxyFactory( u'xxx' )) is unicode) if PYTHON2 else 1 1 Datetime-reltatd instances are rocks, too: @@ -265,6 +264,7 @@ We can do everything we expect to be able to do with proxied dicts. .. doctest:: + >>> from zope.security._compat import PYTHON2 >>> d = ProxyFactory({'a': 1, 'b': 2}) >>> check_forbidden_get(d, 'clear') # Verify that we are protected 'ForbiddenAttribute: clear' @@ -297,11 +297,11 @@ We can do everything we expect to be able to do with proxied dicts. [1, 2] >>> sorted(d.items()) [('a', 1), ('b', 2)] - >>> sorted(d.iterkeys()) if PY2 else ['a', 'b'] + >>> sorted(d.iterkeys()) if PYTHON2 else ['a', 'b'] ['a', 'b'] - >>> sorted(d.itervalues()) if PY2 else [1, 2] + >>> sorted(d.itervalues()) if PYTHON2 else [1, 2] [1, 2] - >>> sorted(d.iteritems()) if PY2 else [('a', 1), ('b', 2)] + >>> sorted(d.iteritems()) if PYTHON2 else [('a', 1), ('b', 2)] [('a', 1), ('b', 2)] Always available (note, that dicts in python-3.x are not orderable, so we are @@ -309,15 +309,16 @@ not checking that under python > 2): .. doctest:: - >>> int(d < d) if PY2 else 0 + >>> from zope.security._compat import PYTHON2 + >>> int(d < d) if PYTHON2 else 0 0 - >>> int(d > d) if PY2 else 0 + >>> int(d > d) if PYTHON2 else 0 0 - >>> int(d <= d) if PY2 else 1 + >>> int(d <= d) if PYTHON2 else 1 1 - >>> int(d >= d) if PY2 else 1 + >>> int(d >= d) if PYTHON2 else 1 1 - >>> int(d == d) if PY2 else 1 + >>> int(d == d) if PYTHON2 else 1 1 >>> int(d != d) 0 @@ -784,6 +785,8 @@ iterators .. doctest:: + >>> [a for a in ProxyFactory(iter([1, 2]))] + [1, 2] >>> list(ProxyFactory(iter([1, 2]))) [1, 2] >>> list(ProxyFactory(iter((1, 2)))) @@ -820,7 +823,7 @@ We can iterate over sequences >>> from zope.security.checker import NamesChecker >>> from zope.security.checker import ProxyFactory - >>> c = NamesChecker(['__getitem__']) + >>> c = NamesChecker(['__getitem__', '__len__']) >>> p = ProxyFactory(x, c) Even if they are proxied @@ -873,13 +876,14 @@ Always available: .. doctest:: - >>> int(C < C) if PY2 else 0 + >>> from zope.security._compat import PYTHON2 + >>> int(C < C) if PYTHON2 else 0 0 - >>> int(C > C) if PY2 else 0 + >>> int(C > C) if PYTHON2 else 0 0 - >>> int(C <= C) if PY2 else 1 + >>> int(C <= C) if PYTHON2 else 1 1 - >>> int(C >= C) if PY2 else 1 + >>> int(C >= C) if PYTHON2 else 1 1 >>> int(C == C) 1 @@ -912,13 +916,14 @@ Always available: .. doctest:: - >>> int(c < c) if PY2 else 0 + >>> from zope.security._compat import PYTHON2 + >>> int(c < c) if PYTHON2 else 0 0 - >>> int(c > c) if PY2 else 0 + >>> int(c > c) if PYTHON2 else 0 0 - >>> int(c <= c) if PY2 else 1 + >>> int(c <= c) if PYTHON2 else 1 1 - >>> int(c >= c) if PY2 else 1 + >>> int(c >= c) if PYTHON2 else 1 1 >>> int(c == c) 1 @@ -935,6 +940,7 @@ Classic Classes .. doctest:: + >>> from zope.security._compat import PYTHON2 >>> class C: ... x = 1 >>> C = ProxyFactory(C) @@ -946,20 +952,21 @@ Classic Classes >>> s = repr(C) >>> int(C.__module__ == __name__) 1 - >>> len(C.__bases__) if PY2 else 0 + >>> len(C.__bases__) if PYTHON2 else 0 0 Always available: .. doctest:: - >>> int(C < C) if PY2 else 0 + >>> from zope.security._compat import PYTHON2 + >>> int(C < C) if PYTHON2 else 0 0 - >>> int(C > C) if PY2 else 0 + >>> int(C > C) if PYTHON2 else 0 0 - >>> int(C <= C) if PY2 else 1 + >>> int(C <= C) if PYTHON2 else 1 1 - >>> int(C >= C) if PY2 else 1 + >>> int(C >= C) if PYTHON2 else 1 1 >>> int(C == C) 1 @@ -989,13 +996,14 @@ Always available: .. doctest:: - >>> int(c < c) if PY2 else 0 + >>> from zope.security._compat import PYTHON2 + >>> int(c < c) if PYTHON2 else 0 0 - >>> int(c > c) if PY2 else 0 + >>> int(c > c) if PYTHON2 else 0 0 - >>> int(c <= c) if PY2 else 1 + >>> int(c <= c) if PYTHON2 else 1 1 - >>> int(c >= c) if PY2 else 1 + >>> int(c >= c) if PYTHON2 else 1 1 >>> int(c == c) 1 @@ -1070,13 +1078,14 @@ Always available: .. doctest:: - >>> int(PBar < PBar) if PY2 else 0 + >>> from zope.security._compat import PYTHON2 + >>> int(PBar < PBar) if PYTHON2 else 0 0 - >>> int(PBar > PBar) if PY2 else 0 + >>> int(PBar > PBar) if PYTHON2 else 0 0 - >>> int(PBar <= PBar) if PY2 else 1 + >>> int(PBar <= PBar) if PYTHON2 else 1 1 - >>> int(PBar >= PBar) if PY2 else 1 + >>> int(PBar >= PBar) if PYTHON2 else 1 1 >>> int(PBar == PBar) 1 @@ -1084,5 +1093,5 @@ Always available: 0 >>> int(bool(PBar)) 1 - >>> int(PBar.__class__ == abc.ABCMeta) if PY2 else 1 + >>> int(PBar.__class__ == abc.ABCMeta) if PYTHON2 else 1 1 diff --git a/src/zope/security/checker.py b/src/zope/security/checker.py index e5f88dc..45ffbb2 100644 --- a/src/zope/security/checker.py +++ b/src/zope/security/checker.py @@ -595,7 +595,7 @@ _typeChecker = NamesChecker( '__implemented__']) _namedChecker = NamesChecker(['__name__']) -_iteratorChecker = NamesChecker(['next', '__iter__']) +_iteratorChecker = NamesChecker(['next', '__iter__', '__len__']) _setChecker = NamesChecker(['__iter__', '__len__', '__str__', '__contains__', 'copy', 'difference', 'intersection', 'issubset', @@ -645,6 +645,10 @@ _basic_types = { if PYTHON2: _basic_types[long] = NoProxy _basic_types[unicode] = NoProxy +else: + _basic_types[type({}.values())] = NoProxy + _basic_types[type({}.keys())] = NoProxy + _basic_types[type({}.items())] = NoProxy try: import pytz -- cgit v1.2.1 From aad857434f77e494a9c1ea1ba90f95bb1cc60551 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Tue, 19 Feb 2013 19:04:48 +0200 Subject: Use python3.3 to run documentation tests --- docs/api/checker.rst | 79 ++------------------------------------------ docs/api/permission.rst | 10 +++--- docs/api/zcml.rst | 3 +- src/zope/security/checker.py | 4 +-- tox.ini | 2 +- 5 files changed, 13 insertions(+), 85 deletions(-) diff --git a/docs/api/checker.rst b/docs/api/checker.rst index 4bf5dc7..58d3595 100644 --- a/docs/api/checker.rst +++ b/docs/api/checker.rst @@ -224,15 +224,6 @@ Rocks are immuatle, non-callable objects without interesting methods. They >>> int(type(ProxyFactory( True )) is type(True)) 1 -Additionally, check some python-2.x specific types. - -.. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(type(ProxyFactory( long(1) )) is long) if PYTHON2 else 1 - 1 - >>> int(type(ProxyFactory( u'xxx' )) is unicode) if PYTHON2 else 1 - 1 - Datetime-reltatd instances are rocks, too: .. doctest:: @@ -264,7 +255,6 @@ We can do everything we expect to be able to do with proxied dicts. .. doctest:: - >>> from zope.security._compat import PYTHON2 >>> d = ProxyFactory({'a': 1, 'b': 2}) >>> check_forbidden_get(d, 'clear') # Verify that we are protected 'ForbiddenAttribute: clear' @@ -297,29 +287,12 @@ We can do everything we expect to be able to do with proxied dicts. [1, 2] >>> sorted(d.items()) [('a', 1), ('b', 2)] - >>> sorted(d.iterkeys()) if PYTHON2 else ['a', 'b'] - ['a', 'b'] - >>> sorted(d.itervalues()) if PYTHON2 else [1, 2] - [1, 2] - >>> sorted(d.iteritems()) if PYTHON2 else [('a', 1), ('b', 2)] - [('a', 1), ('b', 2)] Always available (note, that dicts in python-3.x are not orderable, so we are not checking that under python > 2): .. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(d < d) if PYTHON2 else 0 - 0 - >>> int(d > d) if PYTHON2 else 0 - 0 - >>> int(d <= d) if PYTHON2 else 1 - 1 - >>> int(d >= d) if PYTHON2 else 1 - 1 - >>> int(d == d) if PYTHON2 else 1 - 1 >>> int(d != d) 0 >>> int(bool(d)) @@ -876,15 +849,6 @@ Always available: .. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(C < C) if PYTHON2 else 0 - 0 - >>> int(C > C) if PYTHON2 else 0 - 0 - >>> int(C <= C) if PYTHON2 else 1 - 1 - >>> int(C >= C) if PYTHON2 else 1 - 1 >>> int(C == C) 1 >>> int(C != C) @@ -916,15 +880,6 @@ Always available: .. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(c < c) if PYTHON2 else 0 - 0 - >>> int(c > c) if PYTHON2 else 0 - 0 - >>> int(c <= c) if PYTHON2 else 1 - 1 - >>> int(c >= c) if PYTHON2 else 1 - 1 >>> int(c == c) 1 >>> int(c != c) @@ -940,7 +895,6 @@ Classic Classes .. doctest:: - >>> from zope.security._compat import PYTHON2 >>> class C: ... x = 1 >>> C = ProxyFactory(C) @@ -952,22 +906,13 @@ Classic Classes >>> s = repr(C) >>> int(C.__module__ == __name__) 1 - >>> len(C.__bases__) if PYTHON2 else 0 - 0 + >>> len(C.__bases__) + 1 Always available: .. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(C < C) if PYTHON2 else 0 - 0 - >>> int(C > C) if PYTHON2 else 0 - 0 - >>> int(C <= C) if PYTHON2 else 1 - 1 - >>> int(C >= C) if PYTHON2 else 1 - 1 >>> int(C == C) 1 >>> int(C != C) @@ -996,15 +941,6 @@ Always available: .. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(c < c) if PYTHON2 else 0 - 0 - >>> int(c > c) if PYTHON2 else 0 - 0 - >>> int(c <= c) if PYTHON2 else 1 - 1 - >>> int(c >= c) if PYTHON2 else 1 - 1 >>> int(c == c) 1 >>> int(c != c) @@ -1078,20 +1014,11 @@ Always available: .. doctest:: - >>> from zope.security._compat import PYTHON2 - >>> int(PBar < PBar) if PYTHON2 else 0 - 0 - >>> int(PBar > PBar) if PYTHON2 else 0 - 0 - >>> int(PBar <= PBar) if PYTHON2 else 1 - 1 - >>> int(PBar >= PBar) if PYTHON2 else 1 - 1 >>> int(PBar == PBar) 1 >>> int(PBar != PBar) 0 >>> int(bool(PBar)) 1 - >>> int(PBar.__class__ == abc.ABCMeta) if PYTHON2 else 1 + >>> int(PBar.__class__ == type) 1 diff --git a/docs/api/permission.rst b/docs/api/permission.rst index 64a4250..819cc90 100644 --- a/docs/api/permission.rst +++ b/docs/api/permission.rst @@ -48,7 +48,7 @@ The :data:`zope.security.checker.CheckerPublic` permission always exists: >>> ids = list(allPermissions(None)) >>> ids.sort() >>> ids - [u'x', u'y'] + ['x', 'y'] .. autofunction:: zope.security.permission.PermissionsVocabulary @@ -100,9 +100,9 @@ The non-public permissions 'x' and 'y' are string values: .. doctest:: >>> vocab.getTermByToken('x').value - u'x' + 'x' >>> vocab.getTermByToken('y').value - u'y' + 'y' However, the public permission value is CheckerPublic: @@ -116,7 +116,7 @@ and its title is shortened: .. doctest:: >>> vocab.getTermByToken('zope.Public').title - u'Public' + 'Public' The terms are sorted by title except for the public permission, which is listed first: @@ -124,7 +124,7 @@ listed first: .. doctest:: >>> [term.title for term in vocab] - [u'Public', u'x', u'y'] + ['Public', 'x', 'y'] .. testcleanup:: diff --git a/docs/api/zcml.rst b/docs/api/zcml.rst index 7c03405..a23075a 100644 --- a/docs/api/zcml.rst +++ b/docs/api/zcml.rst @@ -11,8 +11,9 @@ a couple of permissions: >>> from zope.component import getGlobalSiteManager >>> from zope.configuration.xmlconfig import XMLConfig + >>> from zope.component.testing import setUp >>> import zope.security - + >>> setUp() # clear global component registry >>> XMLConfig('permissions.zcml', zope.security)() >>> len(list(getGlobalSiteManager().registeredUtilities())) diff --git a/src/zope/security/checker.py b/src/zope/security/checker.py index 45ffbb2..5f1d7df 100644 --- a/src/zope/security/checker.py +++ b/src/zope/security/checker.py @@ -642,10 +642,10 @@ _basic_types = { datetime.time: NoProxy, datetime.tzinfo: NoProxy, } -if PYTHON2: +if PYTHON2: _basic_types[long] = NoProxy _basic_types[unicode] = NoProxy -else: +else: #pragma NO COVER _basic_types[type({}.values())] = NoProxy _basic_types[type({}.keys())] = NoProxy _basic_types[type({}.items())] = NoProxy diff --git a/tox.ini b/tox.ini index 8524a81..ee015f0 100644 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,7 @@ deps = [testenv:docs] basepython = - python2.6 + python3.3 commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest -- cgit v1.2.1 From 13b9d48c619e18b0c791b39edcbcf30989dd05b9 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Tue, 19 Feb 2013 19:08:33 +0200 Subject: Releasing 4.0.0a4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 91c43d4..7d538d4 100644 --- a/setup.py +++ b/setup.py @@ -103,7 +103,7 @@ else: ] setup(name='zope.security', - version='4.0.0dev', + version='4.0.0a4', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From e70fa6c80ae43a43faaf5e9244ab29fb6246c0c4 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Wed, 20 Feb 2013 10:27:53 +0200 Subject: Python-3.3 compatibility for examples --- src/zope/security/examples/sandbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zope/security/examples/sandbox.py b/src/zope/security/examples/sandbox.py index cb2455c..8a17984 100644 --- a/src/zope/security/examples/sandbox.py +++ b/src/zope/security/examples/sandbox.py @@ -253,7 +253,7 @@ class TimeGenerator(object): home.transportAgent(a, new_home) except Exception as e: print('-- Exception --') - print('moving "%s" from "%s" to "%s"' %(a, h,` new_home`)) + print('moving "%s" from "%s" to "%s"' %(a, h, repr(new_home))) print(e) print() self.teardownAgent(a) -- cgit v1.2.1 From 962c1635f90a31486b9bfdf33a87ed4b2a780f35 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 11:56:25 -0500 Subject: - Remove ``untrustedpython`` extra again, since we do not want to support ``zope.untrustedpython`` in ZTK 2.0. If BBB is really needed, we will create a 3.10.0 release. --- CHANGES.rst | 7 +++++++ setup.py | 1 - src/zope/security/untrustedpython/__init__.py | 17 ----------------- src/zope/security/untrustedpython/builtins.py | 22 ---------------------- src/zope/security/untrustedpython/interpreter.py | 22 ---------------------- src/zope/security/untrustedpython/rcompile.py | 22 ---------------------- 6 files changed, 7 insertions(+), 84 deletions(-) delete mode 100644 src/zope/security/untrustedpython/__init__.py delete mode 100644 src/zope/security/untrustedpython/builtins.py delete mode 100644 src/zope/security/untrustedpython/interpreter.py delete mode 100644 src/zope/security/untrustedpython/rcompile.py diff --git a/CHANGES.rst b/CHANGES.rst index f4e81e5..c3a6043 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,13 @@ CHANGES - ``z.s._proxy.getObject`` - ``z.s._proxy._Proxy`` +4.0.0a4 (unreleased) +-------------------- + +- Remove ``untrustedpython`` extra again, since we do not want to support + ``zope.untrustedpython`` in ZTK 2.0. If BBB is really needed, we will create + a 3.10.0 release. + 4.0.0a3 (2013-02-15) -------------------- diff --git a/setup.py b/setup.py index 7d538d4..8551417 100644 --- a/setup.py +++ b/setup.py @@ -153,7 +153,6 @@ setup(name='zope.security', test=TESTS_REQUIRE, testing=TESTS_REQUIRE + ['nose', 'coverage'], docs=['Sphinx', 'repoze.sphinx.autointerface'], - untrustedpython=['zope.untrustedpython', 'zope.deprecation'], ), include_package_data = True, zip_safe = False, diff --git a/src/zope/security/untrustedpython/__init__.py b/src/zope/security/untrustedpython/__init__.py deleted file mode 100644 index 88f81c0..0000000 --- a/src/zope/security/untrustedpython/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################## -# -# Copyright (c) 2004 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -from warnings import warn -warn('Import from zope.untrustedpython. This BBB module will' - 'be removed in zope.security 4.1', DeprecationWarning, 2) -del warn diff --git a/src/zope/security/untrustedpython/builtins.py b/src/zope/security/untrustedpython/builtins.py deleted file mode 100644 index 6975cc7..0000000 --- a/src/zope/security/untrustedpython/builtins.py +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################## -# -# Copyright (c) 2004 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -from warnings import warn -warn('Import from zope.untrustedpython.builtins. This BBB module will' - 'be removed in zope.security 4.1', DeprecationWarning, 2) -del warn - -try: - from zope.untrustedpython.builtins import * -except ImportError: - pass diff --git a/src/zope/security/untrustedpython/interpreter.py b/src/zope/security/untrustedpython/interpreter.py deleted file mode 100644 index 5ecc36b..0000000 --- a/src/zope/security/untrustedpython/interpreter.py +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################## -# -# Copyright (c) 2004 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -from warnings import warn -warn('Import from zope.untrustedpython.interpreter. This BBB module will' - 'be removed in zope.security 4.1', DeprecationWarning, 2) -del warn - -try: - from zope.untrustedpython.interpreter import * -except ImportError: - pass diff --git a/src/zope/security/untrustedpython/rcompile.py b/src/zope/security/untrustedpython/rcompile.py deleted file mode 100644 index 08eb018..0000000 --- a/src/zope/security/untrustedpython/rcompile.py +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################## -# -# Copyright (c) 2004 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -from warnings import warn -warn('Import from zope.untrustedpython.rcompile. This BBB module will' - 'be removed in zope.security 4.1', DeprecationWarning, 2) -del warn - -try: - from zope.untrustedpython.rcompile import * -except ImportError: - pass -- cgit v1.2.1 From a4621d8b056e284f3a11940de2da7a96e1c05188 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 11:58:29 -0500 Subject: Make the CHANGES zest.releaser friendly and move TODOs to separate file. --- CHANGES.rst | 11 ----------- TODO-4.0.txt | 10 ++++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 TODO-4.0.txt diff --git a/CHANGES.rst b/CHANGES.rst index c3a6043..012114a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,17 +2,6 @@ CHANGES ======= -4.0.0 (unreleased) ------------------- - -- TODO: Add PyPy support - -- TODO: add pure-Python implementations of: - - - ``z.s._proxy.getChecker`` - - ``z.s._proxy.getObject`` - - ``z.s._proxy._Proxy`` - 4.0.0a4 (unreleased) -------------------- diff --git a/TODO-4.0.txt b/TODO-4.0.txt new file mode 100644 index 0000000..bfae913 --- /dev/null +++ b/TODO-4.0.txt @@ -0,0 +1,10 @@ +4.0.0 TODO +---------- + +- TODO: Add PyPy support + +- TODO: add pure-Python implementations of: + + - ``z.s._proxy.getChecker`` + - ``z.s._proxy.getObject`` + - ``z.s._proxy._Proxy`` -- cgit v1.2.1 From 7ebe08e2b733c2b8befced4304520d02ca0ae907 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 11:59:40 -0500 Subject: Preparing release 4.0.0a4 --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 012114a..8d8c72c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,7 +2,7 @@ CHANGES ======= -4.0.0a4 (unreleased) +4.0.0a4 (2013-02-28) -------------------- - Remove ``untrustedpython`` extra again, since we do not want to support -- cgit v1.2.1 From 67e98b83aee9bb678b504d37f7f2fbbd2df58018 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 12:05:01 -0500 Subject: Back to development: 4.0.0a5 --- CHANGES.rst | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8d8c72c..1c434f5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,12 @@ CHANGES ======= +4.0.0a5 (unreleased) +-------------------- + +- Nothing changed yet. + + 4.0.0a4 (2013-02-28) -------------------- diff --git a/setup.py b/setup.py index 8551417..b9385f6 100644 --- a/setup.py +++ b/setup.py @@ -103,7 +103,7 @@ else: ] setup(name='zope.security', - version='4.0.0a4', + version='4.0.0a5.dev0', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From 15686d565ab33ce52008e8c0375bb34bc4c33464 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 13:45:39 -0500 Subject: - Undo changes from 4.0.0a4. Instead, ``zope.untrustedpython`` is only included during Python 2 installs. --- CHANGES.rst | 3 ++- buildout.cfg | 2 +- setup.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1c434f5..d9280de 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,8 @@ CHANGES 4.0.0a5 (unreleased) -------------------- -- Nothing changed yet. +- Undo changes from 4.0.0a4. Instead, ``zope.untrustedpython`` is only + included during Python 2 installs. 4.0.0a4 (2013-02-28) diff --git a/buildout.cfg b/buildout.cfg index 5d65d3b..0a7118d 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -14,7 +14,7 @@ eggs = [python] recipe = zc.recipe.egg eggs = - zope.security + zope.security [test,zcml,pytz,untrustedpython] interpreter = python [coverage-test] diff --git a/setup.py b/setup.py index b9385f6..fa1620c 100644 --- a/setup.py +++ b/setup.py @@ -81,6 +81,7 @@ include = [ModuleHeaderDir('zope.proxy')] # Jython cannot build the C optimizations, while on PyPy they are # anti-optimizations (the C extension compatibility layer is known-slow, # and defeats JIT opportunities). +py3 = sys.version_info[0] >= 3 py_impl = getattr(platform, 'python_implementation', lambda: None) pure_python = os.environ.get('PURE_PYTHON', False) is_pypy = py_impl() == 'PyPy' @@ -149,6 +150,7 @@ setup(name='zope.security', tests_require=TESTS_REQUIRE, extras_require = dict( pytz=["pytz"], + untrustedpython=['zope.untrustedpython'] if not py3 else [], zcml=['zope.configuration'], test=TESTS_REQUIRE, testing=TESTS_REQUIRE + ['nose', 'coverage'], -- cgit v1.2.1 From 6bf4a161cb0cb9d7fa48b7fcf850ce5c89981fca Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 13:45:58 -0500 Subject: Preparing release 4.0.0a5 --- CHANGES.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index d9280de..c3de1a7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,7 +2,7 @@ CHANGES ======= -4.0.0a5 (unreleased) +4.0.0a5 (2013-02-28) -------------------- - Undo changes from 4.0.0a4. Instead, ``zope.untrustedpython`` is only diff --git a/setup.py b/setup.py index fa1620c..fb06e94 100644 --- a/setup.py +++ b/setup.py @@ -104,7 +104,7 @@ else: ] setup(name='zope.security', - version='4.0.0a5.dev0', + version='4.0.0a5', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From ca75fe1d311c485471b53939f5127381cbaa0c40 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 28 Feb 2013 13:48:00 -0500 Subject: Back to development: 4.0.0a6 --- CHANGES.rst | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index c3de1a7..1cfa8ce 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,12 @@ CHANGES ======= +4.0.0a6 (unreleased) +-------------------- + +- Nothing changed yet. + + 4.0.0a5 (2013-02-28) -------------------- diff --git a/setup.py b/setup.py index fb06e94..9bc85a1 100644 --- a/setup.py +++ b/setup.py @@ -104,7 +104,7 @@ else: ] setup(name='zope.security', - version='4.0.0a5', + version='4.0.0a6.dev0', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Zope Security Framework', -- cgit v1.2.1 From 444b1ee3f28c30603eed22dfeb495791b412e3d4 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Mon, 4 Mar 2013 15:35:25 -0500 Subject: 'Updated Travis YAML.' --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6c854d4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: python +python: + - 2.6 + - 2.7 + - 3.2 + - 3.3 +install: + - pip install . --use-mirrors +script: + - python setup.py test -q +notifications: + email: false -- cgit v1.2.1 From 89790a7ade438326cfb610acf77d437511572f40 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Tue, 5 Mar 2013 09:03:53 -0500 Subject: Add zope.testrunner dep to make Travis happy. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9bc85a1..3dae3b8 100644 --- a/setup.py +++ b/setup.py @@ -26,10 +26,11 @@ from setuptools import find_packages from setuptools import setup TESTS_REQUIRE = [ - 'zope.testing', - 'zope.configuration', 'zope.component', + 'zope.configuration', 'zope.location', + 'zope.testing', + 'zope.testrunner', ] def alltests(): -- cgit v1.2.1 From 1af6989173c84e004f1639b1db61cba187d136b2 Mon Sep 17 00:00:00 2001 From: Adam Groszer Date: Thu, 7 Mar 2013 14:49:56 +0000 Subject: Fix build error with MSVC++ on Python 3 --- src/zope/security/_proxy.c | 10 +++++----- src/zope/security/_zope_security_checker.c | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/zope/security/_proxy.c b/src/zope/security/_proxy.c index 52b5040..27edbb3 100644 --- a/src/zope/security/_proxy.c +++ b/src/zope/security/_proxy.c @@ -983,6 +983,11 @@ MOD_INIT(_proxy) { PyObject *m; + MOD_DEF(m, "_proxy", module___doc__, module_functions) + + if (m == NULL) + return MOD_ERROR_VAL; + if (Proxy_Import() < 0) return MOD_ERROR_VAL; @@ -1083,11 +1088,6 @@ if((str_op_##S = INTERN("__" #S "__")) == NULL) return MOD_ERROR_VAL if (PyType_Ready(&SecurityProxyType) < 0) return MOD_ERROR_VAL; - MOD_DEF(m, "_proxy", module___doc__, module_functions) - - if (m == NULL) - return MOD_ERROR_VAL; - Py_INCREF(&SecurityProxyType); PyModule_AddObject(m, "_Proxy", (PyObject *)&SecurityProxyType); diff --git a/src/zope/security/_zope_security_checker.c b/src/zope/security/_zope_security_checker.c index 1b91312..25b6eeb 100644 --- a/src/zope/security/_zope_security_checker.c +++ b/src/zope/security/_zope_security_checker.c @@ -590,6 +590,13 @@ MOD_INIT(_zope_security_checker) { PyObject* m; + MOD_DEF(m, "_zope_security_checker", module___doc__, module_functions) + + if (m == NULL) + { + return MOD_ERROR_VAL; + } + CheckerType.tp_new = PyType_GenericNew; if (PyType_Ready(&CheckerType) < 0) { @@ -673,13 +680,6 @@ if((str_##S = INTERN(#S)) == NULL) return MOD_ERROR_VAL return MOD_ERROR_VAL; } - MOD_DEF(m, "_zope_security_checker", module___doc__, module_functions) - - if (m == NULL) - { - return MOD_ERROR_VAL; - } - #define EXPORT(N) Py_INCREF(N); PyModule_AddObject(m, #N, N) EXPORT(_checkers); -- cgit v1.2.1 From e814c7d9ccf59f3eeff47f91a1e4490e591d4c00 Mon Sep 17 00:00:00 2001 From: agroszer Date: Thu, 7 Mar 2013 15:55:09 +0100 Subject: fixed extension compilation on windows python 3.x --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1cfa8ce..66ba415 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,7 @@ CHANGES 4.0.0a6 (unreleased) -------------------- -- Nothing changed yet. +- fixed extension compilation on windows python 3.x 4.0.0a5 (2013-02-28) -- cgit v1.2.1 From 21bedd54cead429a36545ab4107cd7b1b1b08417 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Fri, 8 Mar 2013 10:18:17 +0200 Subject: Fix ImportError: cannot import name _checkers The problem was a local variable `m` was being clobbered by importing 3rd party modules between the new location of MOD_DEF() and actual use. --- src/zope/security/_zope_security_checker.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/zope/security/_zope_security_checker.c b/src/zope/security/_zope_security_checker.c index 25b6eeb..e5a2528 100644 --- a/src/zope/security/_zope_security_checker.c +++ b/src/zope/security/_zope_security_checker.c @@ -589,10 +589,11 @@ module_functions[] = { MOD_INIT(_zope_security_checker) { PyObject* m; + PyObject* mod; - MOD_DEF(m, "_zope_security_checker", module___doc__, module_functions) + MOD_DEF(mod, "_zope_security_checker", module___doc__, module_functions) - if (m == NULL) + if (mod == NULL) { return MOD_ERROR_VAL; } @@ -680,7 +681,7 @@ if((str_##S = INTERN(#S)) == NULL) return MOD_ERROR_VAL return MOD_ERROR_VAL; } -#define EXPORT(N) Py_INCREF(N); PyModule_AddObject(m, #N, N) +#define EXPORT(N) Py_INCREF(N); PyModule_AddObject(mod, #N, N) EXPORT(_checkers); EXPORT(NoProxy); @@ -688,7 +689,7 @@ if((str_##S = INTERN(#S)) == NULL) return MOD_ERROR_VAL EXPORT(_available_by_default); Py_INCREF(&CheckerType); - PyModule_AddObject(m, "Checker", (PyObject *)&CheckerType); + PyModule_AddObject(mod, "Checker", (PyObject *)&CheckerType); - return MOD_SUCCESS_VAL(m); + return MOD_SUCCESS_VAL(mod); } -- cgit v1.2.1