[Zope-dev] configuration error

Tres Seaver tseaver at palladion.com
Sun Aug 24 14:14:37 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bristow Thankachan wrote:
> hi all,
> 
> We are stuck with a configuration error in porting zope2 to python2.5. Can
> anybody help us in fixing configuration error in the module Zope2.  The full
> log of error message is given below.
> 
> Running tests at level 1
> /home/zope/ztrunk25/lib/python/ZPublisher/HTTPResponse.py:19:
> RuntimeWarning: Python C API version mismatch for module zlib: This Python
> has API version 1013, module zlib has version 1012.
>   import zlib, struct
> Running unit tests:
>   Running:
>     6/43 (14.0%) testStringException1
> (....testExceptionHook.ExceptionHookTest)/home/zope/ztrunk25/lib/python/Zope2/App/tests/testExceptionHook.py:120:
> DeprecationWarning: raising a string exception is deprecated
>   raise 'unauthorized', 'x'
> /home/zope/ztrunk25/lib/python/Zope2/App/startup.py:182: DeprecationWarning:
> raising a string exception is deprecated
>   raise
>     7/43 (16.3%) testStringException2
> (....testExceptionHook.ExceptionHookTest)/home/zope/ztrunk25/lib/python/Zope2/App/tests/testExceptionHook.py:125:
> DeprecationWarning: raising a string exception is deprecated
>   raise 'redirect', 'x'
>     41/43 (95.3%) test_behavior
> (...artup.tests.test_warnfilter.TestWarnFilter)
> 
> Error in test test_behavior
> (Zope2.Startup.tests.test_warnfilter.TestWarnFilter)
> Traceback (most recent call last):
>   File "/home/zope/usr/lib/python2.5/unittest.py", line 260, in run
>     testMethod()
>   File
> "/home/zope/ztrunk25/lib/python/Zope2/Startup/tests/test_warnfilter.py",
> line 90, in test_behavior
>     """)
>   File
> "/home/zope/ztrunk25/lib/python/Zope2/Startup/tests/test_warnfilter.py",
> line 69, in load_config_text
>     conf, handler = ZConfig.loadConfigFile(schema, sio)
>   File "/home/zope/ztrunk25/lib/python/ZConfig/loader.py", line 41, in
> loadConfigFile
>     return _get_config_loader(schema, overrides).loadFile(file, url)
>   File "/home/zope/ztrunk25/lib/python/ZConfig/loader.py", line 75, in
> loadFile
>     return self.loadResource(r)
>   File "/home/zope/ztrunk25/lib/python/ZConfig/loader.py", line 229, in
> loadResource
>     self._parse_resource(sm, resource)
>   File "/home/zope/ztrunk25/lib/python/ZConfig/loader.py", line 280, in
> _parse_resource
>     parser.parse(matcher)
>   File "/home/zope/ztrunk25/lib/python/ZConfig/cfgparser.py", line 57, in
> parse
>     section = self.end_section(section, line[2:-1])
>   File "/home/zope/ztrunk25/lib/python/ZConfig/cfgparser.py", line 112, in
> end_section
>     self.error(e[0])
>   File "/home/zope/ztrunk25/lib/python/ZConfig/cfgparser.py", line 177, in
> error
>     raise ZConfig.ConfigurationSyntaxError(message, self.url, self.lineno)
> ConfigurationSyntaxError: invalid warning category:
> 'Zope2.Startup.tests.test_warnfilter.TestSchemaWarning' (line 8)
> 
> 
>   Ran 43 tests with 0 failures and 1 errors in 15.046 seconds.
> 
> Tests with errors:
>    test_behavior (Zope2.Startup.tests.test_warnfilter.TestWarnFilter)

Because Warning shifts from being an old-style class in 2.4 to a
new-style class in 2.5, the check for 'isinstance(w, types.ClassType))'
won't work.  Instead::

- ----------------------- %< ------------------------
- --- lib/python/Zope2/Startup/warnfilter.py	(revision 90174)
+++ lib/python/Zope2/Startup/warnfilter.py	(working copy)
@@ -35,7 +35,7 @@
             cat = getattr(m, klass)
         except AttributeError:
             raise ValueError("unknown warning category: %s" % `category`)
- -    if (not isinstance(cat, types.ClassType) or
+    if (not isinstance(cat, type(Warning)) or
         not issubclass(cat, Warning)):
         raise ValueError("invalid warning category: %s" % `category`)
     return cat
- ----------------------- %< ------------------------

I have checked this in on the trunk:

 http://svn.zope.org/Zope/trunk/?rev=90177&view=rev


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIsaUN+gerLs4ltQ4RAgwTAJ9roddcaighZb1IUIz8EVBeaFBe7wCfQ5h6
pvNolvSZCYczQMileZ8aDvc=
=tRMb
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list