[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #2295: Comments in PythonScripts could lead to syntax
Log message for revision 76954: - Collector #2295: Comments in PythonScripts could lead to syntax errors Changed: U Zope/branches/2.10/doc/CHANGES.txt U Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py U Zope/branches/2.10/lib/python/RestrictedPython/RCompile.py -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2007-06-23 04:20:55 UTC (rev 76953) +++ Zope/branches/2.10/doc/CHANGES.txt 2007-06-23 07:28:52 UTC (rev 76954) @@ -4,10 +4,13 @@ Change information for previous versions of Zope can be found in the file HISTORY.txt. - Zope 2.10.4 (unreleased) + Zope 2.10.4 (23.06.2007) Bugs fixed + - Collector #2295: Comments in PythonScripts could lead to syntax +errors + - Collector #2307: ObjectCopiedEvent not dispatched to sublocations. - Collector #2304: fixed markup issue in ptEdit.zpt Modified: Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py === --- Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py 2007-06-23 04:20:55 UTC (rev 76953) +++ Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py 2007-06-23 07:28:52 UTC (rev 76954) @@ -128,6 +128,9 @@ res = self._newPS('return 1 * 5 + 4 / 2 - 6')() self.assertEqual(res, 1) +def testCollector2295(self): +res = self._newPS('if False:\n pass\n#hi') + def testReduce(self): res = self._newPS('return reduce(lambda x, y: x + y, [1,3,5,7])')() self.assertEqual(res, 16) Modified: Zope/branches/2.10/lib/python/RestrictedPython/RCompile.py === --- Zope/branches/2.10/lib/python/RestrictedPython/RCompile.py 2007-06-23 04:20:55 UTC (rev 76953) +++ Zope/branches/2.10/lib/python/RestrictedPython/RCompile.py 2007-06-23 07:28:52 UTC (rev 76954) @@ -43,7 +43,7 @@ def __init__(self, source, filename): if source: -source = '\n'.join(source.splitlines()) +source = '\n'.join(source.splitlines()) + '\n' self.rm = RestrictionMutator() AbstractCompileMode.__init__(self, source, filename) @@ -209,7 +209,7 @@ def __init__(self, p, body, name, filename, globals): self.params = p if body: -body = '\n'.join(body.splitlines()) +body = '\n'.join(body.splitlines()) + '\n' self.body = body self.name = name self.globals = globals or [] ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/inst/ preparing 2.9.8
Log message for revision 76960: preparing 2.9.8 Changed: U Zope/branches/2.9/inst/WinBuilders/mk/zope.mk U Zope/branches/2.9/inst/versions.py -=- Modified: Zope/branches/2.9/inst/WinBuilders/mk/zope.mk === --- Zope/branches/2.9/inst/WinBuilders/mk/zope.mk 2007-06-23 07:42:33 UTC (rev 76959) +++ Zope/branches/2.9/inst/WinBuilders/mk/zope.mk 2007-06-23 07:46:35 UTC (rev 76960) @@ -1,4 +1,4 @@ -ZOPEVERSION = 2.9.7 +ZOPEVERSION = 2.9.8 ZOPEDIRNAME := Zope-$(ZOPEVERSION) ZOPE_REQUIRED_FILES=tmp/$(ZOPEDIRNAME).tgz Modified: Zope/branches/2.9/inst/versions.py === --- Zope/branches/2.9/inst/versions.py 2007-06-23 07:42:33 UTC (rev 76959) +++ Zope/branches/2.9/inst/versions.py 2007-06-23 07:46:35 UTC (rev 76960) @@ -1,5 +1,5 @@ ZOPE_MAJOR_VERSION = '2.9' -ZOPE_MINOR_VERSION = '7' +ZOPE_MINOR_VERSION = '8' ZOPE_BRANCH_NAME= '$Name$'[6:] or 'no-branch' # always start prerelease branches with '0' to avoid upgrade ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt - Collector #2295: Comments in PythonScripts could lead to syntax
Log message for revision 76956: - Collector #2295: Comments in PythonScripts could lead to syntax errors Changed: U Zope/trunk/doc/CHANGES.txt -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2007-06-23 07:30:20 UTC (rev 76955) +++ Zope/trunk/doc/CHANGES.txt 2007-06-23 07:32:25 UTC (rev 76956) @@ -97,6 +97,9 @@ Bugs Fixed + - Collector #2295: Comments in PythonScripts could lead to syntax +errors + - Collector #1441: WebDAV compatibility with Windows Web Folders restored by adding a configuration variable that controls the sending of the non-standard MS-Author-Via and Public ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/tags/2.10.4/2.10/ Zope 2.10.4
Log message for revision 76964: Zope 2.10.4 Changed: A Zope/tags/2.10.4/2.10/ -=- Copied: Zope/tags/2.10.4/2.10 (from rev 76963, Zope/branches/2.10) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ Add hasPackage and installPackage functions for dealing with products
Log message for revision 76966: Add hasPackage and installPackage functions for dealing with products registered via five:registerPackage. Changed: U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/__init__.py U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt A Zope/branches/2.10/lib/python/Testing/ZopeTestCase/testpackage/ A Zope/branches/2.10/lib/python/Testing/ZopeTestCase/testpackage/__init__.py A Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py -=- Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py 2007-06-23 08:40:00 UTC (rev 76965) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py 2007-06-23 08:40:48 UTC (rev 76966) @@ -26,7 +26,6 @@ import os, sys, time -import transaction # Allow code to tell it is run by the test framework os.environ['ZOPETESTCASE'] = '1' @@ -133,62 +132,60 @@ # Allow test authors to install Zope products into the test environment. Note # that installProduct() must be called at module level -- never from tests. -from OFS.Application import get_folder_permissions, get_products, install_product +from OFS.Application import get_folder_permissions, get_products +from OFS.Application import install_product, install_package from OFS.Folder import Folder import Products _theApp = Zope2.app() _installedProducts = {} +_installedPackages = {} def hasProduct(name): '''Checks if a product can be found along Products.__path__''' return name in [n[1] for n in get_products()] -def installProduct(name, quiet=0, package=False): +def installProduct(name, quiet=0): '''Installs a Zope product.''' start = time.time() meta_types = [] if _patched and not _installedProducts.has_key(name): -if package: -# Processing of products-as-packages can be simpler; also check -# whether this has been registered with five:registerPackage / -# and has not been loaded. -for module_, init_func in getattr(Products, '_packages_to_initialize', []): -if module_.__name__ == name: -if not quiet: _print('Installing %s ... ' % name) -try: -product = App.Product.initializeProduct(module_, - module_.__name__, - module_.__path__[0], -_theApp) +for priority, product_name, index, product_dir in get_products(): +if product_name == name: +if not quiet: _print('Installing %s ... ' % product_name) +# We want to fail immediately if a product throws an exception +# during install, so we set the raise_exc flag. +install_product(_theApp, product_dir, product_name, meta_types, +get_folder_permissions(), raise_exc=1) +_installedProducts[product_name] = 1 +Products.meta_types = Products.meta_types + tuple(meta_types) +Globals.InitializeClass(Folder) +if not quiet: _print('done (%.3fs)\n' % (time.time() - start)) +break +else: +if name != 'SomeProduct': # Ignore the skeleton tests :-P +if not quiet: _print('Installing %s ... NOT FOUND\n' % name) -product.package_name = module_.__name__ +def hasPackage(name): +'''Checks if a package has been registered with five:registerPackage.''' +return name in [m.__name__ for m, f in Products._packages_to_initialize] -if init_func is not None: -newContext = App.ProductContext.ProductContext(product, app, module_) -init_func(newContext) -finally: -transaction.commit() - -Globals.InitializeClass(Folder) -if not quiet: _print('done (%.3fs)\n' % (time.time() - start)) -break +def installPackage(name, quiet=0): +'''Installs a registered Python package like a Zope product.''' +start = time.time() +if _patched and not _installedPackages.has_key(name): +for module, init_func in Products._packages_to_initialize: +if module.__name__ == name: +if not quiet: _print('Installing %s ... ' % module.__name__) +# We want to fail immediately if a package throws an exception +# during install, so we set the raise_exc flag. +
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/OFS/Application.py Extract package installation code into its own function so it can be reused.
Log message for revision 76965: Extract package installation code into its own function so it can be reused. Changed: U Zope/branches/2.10/lib/python/OFS/Application.py -=- Modified: Zope/branches/2.10/lib/python/OFS/Application.py === --- Zope/branches/2.10/lib/python/OFS/Application.py2007-06-23 08:13:35 UTC (rev 76964) +++ Zope/branches/2.10/lib/python/OFS/Application.py2007-06-23 08:40:00 UTC (rev 76965) @@ -633,21 +633,9 @@ install_product(app, product_dir, product_name, meta_types, folder_permissions, raise_exc=debug_mode) -# Delayed install of products-as-packages -for module_, init_func in getattr(Products, '_packages_to_initialize', []): -try: -product = App.Product.initializeProduct(module_, -module_.__name__, -module_.__path__[0], -app) - -product.package_name = module_.__name__ - -if init_func is not None: -newContext = ProductContext(product, app, module_) -init_func(newContext) -finally: -transaction.commit() +# Delayed install of packages-as-products +for module, init_func in Products._packages_to_initialize: +install_package(app, module, init_func, raise_exc=debug_mode) Products._packages_to_initialize = [] Products.meta_types=Products.meta_types+tuple(meta_types) @@ -878,6 +866,34 @@ if raise_exc: raise + +def install_package(app, module, init_func, raise_exc=False, log_exc=True): +Installs a Python package like a product. +try: +product = App.Product.initializeProduct(module, +module.__name__, +module.__path__[0], +app) +product.package_name = module.__name__ +if init_func is not None: +newContext = ProductContext(product, app, module) +init_func(newContext) + +if not doInstall(): +transaction.abort() +else: +transaction.get().note('Installed package %s' % module.__name__) +transaction.commit() + +except: +if log_exc: +LOG.error(Couldn't install %s % module.__name__, + exc_info=True) +transaction.abort() +if raise_exc: +raise + + def install_standards(app): # Check to see if we've already done this before # Don't do it twice (Casey) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/tags/2.10.4/ removed
Log message for revision 76971: removed Changed: D Zope/tags/2.10.4/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ Stitched Five 1.5.4 tag into Zope 2.10 branch.
Log message for revision 76970: Stitched Five 1.5.4 tag into Zope 2.10 branch. Changed: _U Zope/branches/2.10/lib/python/Products/ -=- Property changes on: Zope/branches/2.10/lib/python/Products ___ Name: svn:externals - Fivesvn://svn.zope.org/repos/main/Products.Five/tags/1.5.3 + Fivesvn://svn.zope.org/repos/main/Products.Five/tags/1.5.4 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/tags/1.5.4/ Tagged Five 1.5.4 at r76968.
Log message for revision 76969: Tagged Five 1.5.4 at r76968. Changed: A Products.Five/tags/1.5.4/ -=- Copied: Products.Five/tags/1.5.4 (from rev 76968, Products.Five/branches/1.5) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ hasPackage consulted the wrong registry, oops.
Log message for revision 76984: hasPackage consulted the wrong registry, oops. Changed: U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py -=- Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py 2007-06-23 12:14:40 UTC (rev 76983) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ZopeLite.py 2007-06-23 12:16:34 UTC (rev 76984) @@ -168,7 +168,7 @@ def hasPackage(name): '''Checks if a package has been registered with five:registerPackage.''' -return name in [m.__name__ for m, f in Products._packages_to_initialize] +return name in [m.__name__ for m in getattr(Products, '_registered_packages', [])] def installPackage(name, quiet=0): '''Installs a registered Python package like a Zope product.''' Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py 2007-06-23 12:14:40 UTC (rev 76983) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py 2007-06-23 12:16:34 UTC (rev 76984) @@ -74,6 +74,11 @@ True ZopeTestCase.close(app) +hasPackage still returns True + + ZopeTestCase.hasPackage('testpackage') + True + Clean up import testpackage ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/ Provide access to test globs in doctest setUp and tearDown.
Log message for revision 76991: Provide access to test globs in doctest setUp and tearDown. Changed: U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py -=- Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2007-06-23 17:08:40 UTC (rev 76990) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2007-06-23 17:26:25 UTC (rev 76991) @@ -14,6 +14,7 @@ publish_module(). Thanks to Andreas Zeidler. - Fixed doctestsuite factory to copy layers from test_class to the suite. Thanks to Whit Morris. +- Provide access to test globs in doctest setUp and tearDown. 0.9.8 (Zope 2.8 edition) - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2007-06-23 17:08:40 UTC (rev 76990) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2007-06-23 17:26:25 UTC (rev 76991) @@ -261,6 +261,7 @@ if hasattr(test_instance, 'portal'): test.globs['portal'] = test_instance.portal test.globs['portal_name'] = test_instance.portal.getId() +test_instance.globs = test.globs if kwsetUp is not None: kwsetUp(test_instance) Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py 2007-06-23 17:08:40 UTC (rev 76990) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py 2007-06-23 17:26:25 UTC (rev 76991) @@ -38,6 +38,9 @@ Content-Type: text/plain; charset=... BLANKLINE index + + foo +1 ''' self.folder.addDTMLDocument('index_html', file='index') @@ -55,7 +58,9 @@ /dtml-in''' self.folder.addDTMLMethod('show_cookies', file=show_cookies) +self.globs['foo'] = 1 + def test_suite(): return TestSuite(( FunctionalDocTestSuite(setUp=setUp), Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py 2007-06-23 17:08:40 UTC (rev 76990) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py 2007-06-23 17:26:25 UTC (rev 76991) @@ -29,8 +29,12 @@ 'object' in folder.objectIds() True + + foo +1 ''' self.folder.manage_addFolder('object', '') +self.globs['foo'] = 1 def test_suite(): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ Provide access to test globs in doctest setUp and tearDown.
Log message for revision 76990: Provide access to test globs in doctest setUp and tearDown. Changed: U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py -=- Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2007-06-23 17:08:16 UTC (rev 76989) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2007-06-23 17:08:40 UTC (rev 76990) @@ -16,6 +16,7 @@ Thanks to Whit Morris. - Added hasPackage and installPackage functions for dealing with products registered via five:registerPackage. +- Provide access to test globs in doctest setUp and tearDown. 0.9.8 (Zope 2.8 edition) - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2007-06-23 17:08:16 UTC (rev 76989) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2007-06-23 17:08:40 UTC (rev 76990) @@ -253,6 +253,7 @@ if hasattr(test_instance, 'portal'): test.globs['portal'] = test_instance.portal test.globs['portal_name'] = test_instance.portal.getId() +test_instance.globs = test.globs if kwsetUp is not None: kwsetUp(test_instance) Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py 2007-06-23 17:08:16 UTC (rev 76989) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py 2007-06-23 17:08:40 UTC (rev 76990) @@ -38,6 +38,9 @@ Content-Type: text/plain; charset=... BLANKLINE index + + foo +1 ''' self.folder.addDTMLDocument('index_html', file='index') @@ -55,7 +58,9 @@ /dtml-in''' self.folder.addDTMLMethod('show_cookies', file=show_cookies) +self.globs['foo'] = 1 + def test_suite(): return TestSuite(( FunctionalDocTestSuite(setUp=setUp), Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py === --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py 2007-06-23 17:08:16 UTC (rev 76989) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py 2007-06-23 17:08:40 UTC (rev 76990) @@ -12,7 +12,7 @@ ## Example Zope doctest -$Id: testZopeDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $ +$Id$ import os, sys @@ -29,8 +29,12 @@ 'object' in folder.objectIds() True + + foo +1 ''' self.folder.manage_addFolder('object', '') +self.globs['foo'] = 1 def test_suite(): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins