[Zope-Checkins] SVN: Zope/branches/2.9/ - Fix #2155: Wrong parameters being passed to logger's error().

2006-08-18 Thread Sidnei da Silva
Log message for revision 69658:
  - Fix #2155: Wrong parameters being passed to logger's error().
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/ZPublisher/BeforeTraverse.py
  A   Zope/branches/2.9/lib/python/ZPublisher/tests/testBeforeTraverse.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2006-08-18 16:10:19 UTC (rev 69657)
+++ Zope/branches/2.9/doc/CHANGES.txt   2006-08-18 16:34:06 UTC (rev 69658)
@@ -16,6 +16,9 @@
   - Usage of 'urljoin' in 'webdav.davcmds' could lead to wrongly
 constructed urls.
 
+  - Collector #2155: Fix wrong parameter being passed to
+logger's error() method, with tests.
+
   Zope 2.9.4 (2006/07/21)
 
Bugs fixed

Modified: Zope/branches/2.9/lib/python/ZPublisher/BeforeTraverse.py
===
--- Zope/branches/2.9/lib/python/ZPublisher/BeforeTraverse.py   2006-08-18 
16:10:19 UTC (rev 69657)
+++ Zope/branches/2.9/lib/python/ZPublisher/BeforeTraverse.py   2006-08-18 
16:34:06 UTC (rev 69658)
@@ -13,10 +13,9 @@
 __version__='$Revision: 1.12 $'[11:-2]
 
 BeforeTraverse interface and helper classes
-import logging
 
+import logging
 from Acquisition import aq_base
-import sys
 
 # Interface
 
@@ -105,7 +104,7 @@
 cob(container, request)
 except TypeError:
 self.logger.error('%s call %s failed.' % (
-`self._hookname`, `cob`), error=sys.exc_info())
+`self._hookname`, `cob`), exc_info=True)
 
 def add(self, cob):
 self._list.append(cob)
@@ -151,6 +150,5 @@
 # Only catch exceptions that are likely to be logic errors.
 # We shouldn't catch Redirects, Unauthorizeds, etc. since
 # the programmer may want to raise them deliberately.
-import sys
 self.logger.error('Error while invoking hook: %s'
-% self.name, error=sys.exc_info())
+% self.name, exc_info=True)

Added: Zope/branches/2.9/lib/python/ZPublisher/tests/testBeforeTraverse.py
===
--- Zope/branches/2.9/lib/python/ZPublisher/tests/testBeforeTraverse.py 
2006-08-18 16:10:19 UTC (rev 69657)
+++ Zope/branches/2.9/lib/python/ZPublisher/tests/testBeforeTraverse.py 
2006-08-18 16:34:06 UTC (rev 69658)
@@ -0,0 +1,153 @@
+import sys
+import logging
+
+from Acquisition import Implicit
+from ZPublisher import BeforeTraverse
+from ZPublisher.BaseRequest import BaseRequest
+from ZPublisher.HTTPResponse import HTTPResponse
+
+def makeBaseRequest(root):
+response = HTTPResponse()
+environment = { 'URL': '',
+   'PARENTS': [root],
+   'steps': [],
+   '_hacked_path': 0,
+   '_test_counter': 0,
+   'response': response }
+return BaseRequest(environment)
+
+
+class DummyObjectBasic(Implicit):
+ Dummy class with docstring.
+
+pass
+
+
+class BrokenHook:
+
+def __call__(self, *args):
+   print self.__class__.__name__, 'called'
+   raise TypeError, self.__class__.__name__
+
+def testBeforeTraverse(self):
+ 
+Zope supports a 'before traverse' hook that is used for several
+features, including 'Site Access Rules'. It is implemented using a
+special API for registering hooks, and the hooks themselves are
+called during traversal by ZPublisher.
+
+ root = DummyObjectBasic()
+ request = makeBaseRequest(root)
+
+ container = DummyObjectBasic()
+ root.container = container
+
+ obj = DummyObjectBasic()
+ container.obj = obj
+
+Setup a broken hook as the before traverse hook for the
+container. That will create a 'MultiHook' object:
+
+ BeforeTraverse.registerBeforeTraverse(container, BrokenHook(),
+...'broken_hook')
+
+ container.__before_publishing_traverse__
+ZPublisher.BeforeTraverse.MultiHook instance at ...
+
+ container.__before_traverse__
+{(99, 'broken_hook'): ZPublisher.tests.testBeforeTraverse.BrokenHook ...}
+
+Setup logging so we can see the actual exception being logged:
+
+ logger = logging.getLogger('MultiHook')
+ level = logger.level
+ handlers = logger.handlers[:]
+
+ logger.addHandler(logging.StreamHandler(sys.stdout))
+ logger.setLevel(logging.ERROR)
+
+Now do the actual traversal:
+
+ _ = request.traverse('container/obj')
+BrokenHook called
+'__before_publishing_traverse__' call ... failed.
+Traceback (most recent call last):
+...
+TypeError: BrokenHook
+
+Unregister the borken hook:
+
+ _ = BeforeTraverse.unregisterBeforeTraverse(container, 'broken_hook')
+
+The list of 'before traverse' hooks is empty:
+
+ container.__before_traverse__
+{}
+
+But the 

[Zope-Checkins] SVN: Zope/branches/2.10/ - Fix #2155: Wrong parameters being passed to logger's error().

2006-08-18 Thread Sidnei da Silva
Log message for revision 69659:
  - Fix #2155: Wrong parameters being passed to logger's error().
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/ZPublisher/BeforeTraverse.py
  A   Zope/branches/2.10/lib/python/ZPublisher/tests/testBeforeTraverse.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===
--- Zope/branches/2.10/doc/CHANGES.txt  2006-08-18 16:34:06 UTC (rev 69658)
+++ Zope/branches/2.10/doc/CHANGES.txt  2006-08-18 16:46:42 UTC (rev 69659)
@@ -8,6 +8,9 @@
 
 Bugs Fixed
 
+  - Collector #2155: Fix wrong parameter being passed to
+logger's error() method, with tests.
+
   - Updated Five to stable 1.5 release.
 
   - Traversal order changes were causing WebDAV requests which used

Modified: Zope/branches/2.10/lib/python/ZPublisher/BeforeTraverse.py
===
--- Zope/branches/2.10/lib/python/ZPublisher/BeforeTraverse.py  2006-08-18 
16:34:06 UTC (rev 69658)
+++ Zope/branches/2.10/lib/python/ZPublisher/BeforeTraverse.py  2006-08-18 
16:46:42 UTC (rev 69659)
@@ -16,7 +16,6 @@
 
 from Acquisition import aq_base
 from logging import getLogger
-import sys
 
 # Interface
 
@@ -106,7 +105,7 @@
 cob(container, request)
 except TypeError:
 LOG.error('%s call %s failed.' % (
-`self._hookname`, `cob`), exc_info=sys.exc_info())
+`self._hookname`, `cob`), exc_info=True)
 
 def add(self, cob):
 self._list.append(cob)
@@ -151,6 +150,5 @@
 # Only catch exceptions that are likely to be logic errors.
 # We shouldn't catch Redirects, Unauthorizeds, etc. since
 # the programmer may want to raise them deliberately.
-
 LOG.error('BeforeTraverse: Error while invoking hook: %s' % 
self.name, 
-  exc_info=sys.exc_info())
+  exc_info=True)

Copied: Zope/branches/2.10/lib/python/ZPublisher/tests/testBeforeTraverse.py 
(from rev 69658, 
Zope/branches/2.9/lib/python/ZPublisher/tests/testBeforeTraverse.py)
===
--- Zope/branches/2.9/lib/python/ZPublisher/tests/testBeforeTraverse.py 
2006-08-18 16:34:06 UTC (rev 69658)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testBeforeTraverse.py
2006-08-18 16:46:42 UTC (rev 69659)
@@ -0,0 +1,139 @@
+import sys
+import logging
+
+from Acquisition import Implicit
+from ZPublisher import BeforeTraverse
+from ZPublisher.BaseRequest import BaseRequest
+from ZPublisher.HTTPResponse import HTTPResponse
+
+def makeBaseRequest(root):
+response = HTTPResponse()
+environment = { 'URL': '',
+   'PARENTS': [root],
+   'steps': [],
+   '_hacked_path': 0,
+   '_test_counter': 0,
+   'response': response }
+return BaseRequest(environment)
+
+
+class DummyObjectBasic(Implicit):
+ Dummy class with docstring.
+
+pass
+
+
+class BrokenHook:
+
+def __call__(self, *args):
+   print self.__class__.__name__, 'called'
+   raise TypeError, self.__class__.__name__
+
+def testBeforeTraverse(self):
+ 
+Zope supports a 'before traverse' hook that is used for several
+features, including 'Site Access Rules'. It is implemented using a
+special API for registering hooks, and the hooks themselves are
+called during traversal by ZPublisher.
+
+ root = DummyObjectBasic()
+ request = makeBaseRequest(root)
+
+ container = DummyObjectBasic()
+ root.container = container
+
+ obj = DummyObjectBasic()
+ container.obj = obj
+
+Setup a broken hook as the before traverse hook for the
+container. That will create a 'MultiHook' object:
+
+ BeforeTraverse.registerBeforeTraverse(container, BrokenHook(),
+...'broken_hook')
+
+ container.__before_publishing_traverse__
+ZPublisher.BeforeTraverse.MultiHook instance at ...
+
+ container.__before_traverse__
+{(99, 'broken_hook'): ZPublisher.tests.testBeforeTraverse.BrokenHook ...}
+
+Setup logging so we can see the actual exception being logged:
+
+ logger = logging.getLogger('ZPublisher')
+ level = logger.level
+ handlers = logger.handlers[:]
+
+ logger.addHandler(logging.StreamHandler(sys.stdout))
+ logger.setLevel(logging.ERROR)
+
+Now do the actual traversal:
+
+ _ = request.traverse('container/obj')
+BrokenHook called
+'__before_publishing_traverse__' call ... failed.
+Traceback (most recent call last):
+...
+TypeError: BrokenHook
+
+Unregister the borken hook:
+
+ _ = BeforeTraverse.unregisterBeforeTraverse(container, 'broken_hook')
+
+The list of 'before traverse' hooks is empty:
+
+ container.__before_traverse__
+{}
+
+But the 'MultiHook' is not 

[Zope-Checkins] SVN: Products.Five/branches/1.4-layers/ adding test layer support

2006-08-18 Thread david whitfield Morriss
Log message for revision 69673:
  adding test layer support
  

Changed:
  A   Products.Five/branches/1.4-layers/

-=-
Copied: Products.Five/branches/1.4-layers (from rev 69672, 
Products.Five/branches/1.4)

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Products.Five/branches/1.4-layers/viewlet/tests.py adding comma

2006-08-18 Thread david whitfield Morriss
Log message for revision 69675:
  adding comma
  

Changed:
  U   Products.Five/branches/1.4-layers/viewlet/tests.py

-=-
Modified: Products.Five/branches/1.4-layers/viewlet/tests.py
===
--- Products.Five/branches/1.4-layers/viewlet/tests.py  2006-08-18 23:22:53 UTC 
(rev 69674)
+++ Products.Five/branches/1.4-layers/viewlet/tests.py  2006-08-18 23:23:21 UTC 
(rev 69675)
@@ -87,7 +87,7 @@
 return unittest.TestSuite((
 FunctionalDocFileSuite('README.txt'),
 FunctionalDocFileSuite('directives.txt',
-   package='Products.Five.viewlet'
+   package='Products.Five.viewlet',
setUp=setUp, tearDown=tearDown
),
 ))

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Products.Five/branches/1.4-layers/ adding layers, bumping version

2006-08-18 Thread david whitfield Morriss
Log message for revision 69676:
  adding layers, bumping version

Changed:
  A   Products.Five/branches/1.4-layers/tests/testing/layer.py
  U   Products.Five/branches/1.4-layers/version.txt

-=-
Added: Products.Five/branches/1.4-layers/tests/testing/layer.py
===
--- Products.Five/branches/1.4-layers/tests/testing/layer.py2006-08-18 
23:23:21 UTC (rev 69675)
+++ Products.Five/branches/1.4-layers/tests/testing/layer.py2006-08-18 
23:27:50 UTC (rev 69676)
@@ -0,0 +1,20 @@
+from Testing.ZopeTestCase.utils import setDebugMode
+from Testing.ZopeTestCase.layer import Zope2Layer
+
+class ZCMLLayer:
+@classmethod
+def setUp(cls):
+# this keeps five from hiding config errors while toggle debug
+# back on to let PTC perform efficiently
+setDebugMode(1)
+from Products.Five import zcml
+zcml.load_site()
+setDebugMode(0)
+
+@classmethod
+def tearDown(cls):
+from zope.testing.cleanup import cleanUp
+cleanUp()
+
+class FiveLayer(ZCMLLayer, Zope2Layer):
+3 + 2

Modified: Products.Five/branches/1.4-layers/version.txt
===
--- Products.Five/branches/1.4-layers/version.txt   2006-08-18 23:23:21 UTC 
(rev 69675)
+++ Products.Five/branches/1.4-layers/version.txt   2006-08-18 23:27:50 UTC 
(rev 69676)
@@ -1 +1 @@
-Five 1.4.1
+Five 1.4.1 (layers mod svn)

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.9-layer-support/ integrating layer support for tests in Testing.ZopeTestCase

2006-08-18 Thread david whitfield Morriss
Log message for revision 69677:
  integrating layer support for tests in Testing.ZopeTestCase
  

Changed:
  A   Zope/branches/2.9-layer-support/

-=-
Copied: Zope/branches/2.9-layer-support (from rev 69676, Zope/branches/2.9)

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.9-layer-support/lib/python/Testing/ starting merge

2006-08-18 Thread david whitfield Morriss
Log message for revision 69678:
  starting merge
  

Changed:
  A   Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py
  A   Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py
  A   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
  A   Zope/branches/2.9-layer-support/lib/python/Testing/tmp/

-=-
Added: Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py
===
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py
2006-08-19 00:59:19 UTC (rev 69677)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py
2006-08-19 02:33:50 UTC (rev 69678)
@@ -0,0 +1,54 @@
+##
+#
+# Copyright (c) 2005 Zope Corporation 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.
+#
+##
+
+layer support for ZopeTestCase
+
+$Id: $
+
+import os
+from utils import setDebugMode
+
+class ZopeLiteLayer:
+@classmethod
+def setUp(cls):
+import ZopeLite
+
+@classmethod
+def tearDown(cls):
+raise NotImplementedError
+
+# products to install
+_products=[]
+
+# setup functions
+_z2_callables=[]
+class Zope2Layer(ZopeLiteLayer):
+ stacks upon ZopeLiteLayer and handles products installs 
+@classmethod
+def setUp(cls):
+import ZopeLite as Zope2
+install = Zope2.installProduct
+
+[install(name, quiet=quiet) \
+ for name, quiet in _products]
+
+[func(*args, **kw) for func, args, kw in _z2_callables]
+
+@classmethod
+def tearDown(cls):
+raise NotImplementedError
+
+
+def installProduct(name, quiet=0):
+if not (name, quiet) in _products:
+_products.append((name, quiet))

Added: Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py
===
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py
2006-08-19 00:59:19 UTC (rev 69677)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py
2006-08-19 02:33:50 UTC (rev 69678)
@@ -0,0 +1,15 @@
+import os, sys
+import unittest
+suite = unittest.TestSuite()
+
+def test_suite():
+names = os.listdir(os.path.dirname(__file__))
+tests = [x for x in names \
+ if x.startswith('test') and x.endswith('.py') and not x == 
'tests.py']
+
+for test in tests:
+Testing = __import__(Testing.ZopeTestCase. + test[:-3])
+testmodule = getattr(Testing.ZopeTestCase, test[:-3])
+if hasattr(testmodule, 'test_suite'):
+suite.addTest(testmodule.test_suite())
+return suite

Added: 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
===
--- 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
2006-08-19 00:59:19 UTC (rev 69677)
+++ 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
2006-08-19 02:33:50 UTC (rev 69678)
@@ -0,0 +1,15 @@
+import os, sys
+import unittest
+suite = unittest.TestSuite()
+
+def test_suite():
+names = os.listdir(os.path.dirname(__file__))
+tests = [x for x in names \
+ if x.startswith('test') and x.endswith('.py') and not x == 
'tests.py']
+
+for test in tests:
+Testing = __import__(Testing.ZopeTestCase.zopedoctest. + test[:-3])
+testmodule = getattr(Testing.ZopeTestCase.zopedoctest, test[:-3])
+if hasattr(testmodule, 'test_suite'):
+suite.addTest(testmodule.test_suite())
+return suite

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.9-layer-support/lib/python/Testing/tmp/ removing tmp dir

2006-08-18 Thread david whitfield Morriss
Log message for revision 69680:
  removing tmp dir
  

Changed:
  D   Zope/branches/2.9-layer-support/lib/python/Testing/tmp/

-=-
___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ merging layers implementation

2006-08-18 Thread david whitfield Morriss
Log message for revision 69681:
  merging layers implementation
  

Changed:
  U   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeLite.py
  U   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeTestCase.py
  U   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/__init__.py
  U   Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/base.py
  U   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/placeless.py
  U   Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/sandbox.py
  U   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/__init__.py
  U   
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py

-=-
Modified: 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeLite.py
===
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeLite.py 
2006-08-19 03:11:51 UTC (rev 69680)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeLite.py 
2006-08-19 03:28:13 UTC (rev 69681)
@@ -26,6 +26,7 @@
 
 
 import os, sys, time
+from utils import hasProduct, _print
 
 # Allow code to tell it is run by the test framework
 os.environ['ZOPETESTCASE'] = '1'
@@ -36,11 +37,6 @@
 # Shut up if we are not in control of the import process
 _quiet = sys.modules.has_key('Zope2')
 
-def _print(msg):
-'''Writes 'msg' to stderr and flushes the stream.'''
-sys.stderr.write(msg)
-sys.stderr.flush()
-
 def _write(msg):
 '''Writes 'msg' to stderr if not _quiet.'''
 if not _quiet:
@@ -139,10 +135,6 @@
 _theApp = Zope2.app()
 _installedProducts = {}
 
-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):
 '''Installs a Zope product.'''
 start = time.time()

Modified: 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeTestCase.py
===
--- 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeTestCase.py 
2006-08-19 03:11:51 UTC (rev 69680)
+++ 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/ZopeTestCase.py 
2006-08-19 03:28:13 UTC (rev 69681)
@@ -29,6 +29,7 @@
 import interfaces
 import utils
 import connections
+import layer
 
 from AccessControl import getSecurityManager
 from AccessControl.SecurityManagement import newSecurityManager
@@ -51,6 +52,8 @@
 
 _setup_fixture = 1
 
+layer = layer.Zope2Layer
+
 def _setup(self):
 '''Sets up the fixture. Framework authors may
override.

Modified: 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/__init__.py
===
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/__init__.py 
2006-08-19 03:11:51 UTC (rev 69680)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/__init__.py 
2006-08-19 03:28:13 UTC (rev 69681)
@@ -15,12 +15,12 @@
 $Id$
 
 
-import ZopeLite as Zope2
 import utils
 
-from ZopeLite import hasProduct
-from ZopeLite import installProduct
-from ZopeLite import _print
+from utils import hasProduct
+from layer import installProduct
+from utils import _print
+from utils import setAllLayers
 
 from ZopeTestCase import folder_name
 from ZopeTestCase import user_name
@@ -49,9 +49,10 @@
 from zopedoctest import FunctionalDocTestSuite
 from zopedoctest import FunctionalDocFileSuite
 
+from layer import ZopeLiteLayer
+from layer import Zope2Layer
+
 import zopedoctest as doctest
 import transaction
 import placeless
 
-Zope = Zope2
-

Modified: 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/base.py
===
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/base.py 
2006-08-19 03:11:51 UTC (rev 69680)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/base.py 
2006-08-19 03:28:13 UTC (rev 69681)
@@ -15,7 +15,6 @@
 $Id$
 
 
-import ZopeLite as Zope2
 import unittest
 import transaction
 import profiler
@@ -25,10 +24,9 @@
 
 from AccessControl.SecurityManagement import noSecurityManager
 
-
-
 def app():
 '''Opens a ZODB connection and returns the app object.'''
+import ZopeLite as Zope2
 app = Zope2.app()
 app = utils.makerequest(app)
 connections.register(app)

Modified: 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/placeless.py
===
--- 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/placeless.py
2006-08-19 03:11:51 UTC (rev 69680)
+++ 
Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/placeless.py
2006-08-19 03:28:13 UTC (rev 69681)
@@ -44,9 +44,6 @@
 

[Zope-Checkins] SVN: Zope/branches/2.9-layer-support/lib/python/Products/ point five at 1.4-layers

2006-08-18 Thread david whitfield Morriss
Log message for revision 69682:
  point five at 1.4-layers
  

Changed:
  _U  Zope/branches/2.9-layer-support/lib/python/Products/

-=-

Property changes on: Zope/branches/2.9-layer-support/lib/python/Products
___
Name: svn:externals
   - Five svn://svn.zope.org/repos/main/Products.Five/tags/1.3.7

   + Five svn://svn.zope.org/repos/main/Products.Five/branches/1.4-layers


___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-dev] buildbot failure in Zope branches 2.9 2.4 Windows 2000 zc-bbwin2

2006-08-18 Thread buildbot
The Buildbot has detected a failed build of Zope branches 2.9 2.4 Windows 2000 
zc-bbwin2.

Buildbot URL: http://buildbot.zope.org/

Build Reason: changes
Build Source Stamp: 7149
Blamelist: 
baijum,batlogg,benji_york,chrism,ctheune,dobe,faassen,fdrake,flindner,flox,gintautasm,jens,jim,jukart,mj,philikon,poster,regebro,rogerineichen,schwendinger,shh,sidnei,srichter,tseaver

BUILD FAILED: failed compile

sincerely,
 -The Buildbot

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] buildbot failure in Zope branches 2.9 2.4 Windows 2000 zc-bbwin2

2006-08-18 Thread buildbot
The Buildbot has detected a failed build of Zope branches 2.9 2.4 Windows 2000 
zc-bbwin2.

Buildbot URL: http://buildbot.zope.org/

Build Reason: The web-page 'force build' button was pressed by 'Benji': Try 
again

Build Source Stamp: None
Blamelist: 

BUILD FAILED: failed compile

sincerely,
 -The Buildbot

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Fixing Windows Slaves?

2006-08-18 Thread Sidnei da Silva
Can someone fix the Windows build slaves please?
-- 
Sidnei da Silva
Enfold Systemshttp://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-PAS] Plone Group assignment to LDAP group

2006-08-18 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 17 Aug 2006, at 10:36, Stephen Kenworthy wrote:


Hi all,

I've been trying out the Plone 2.5, Zope 2.8.7 release for the  
first time and looking to migrate our intranet which is currently  
Plone 2.1.


I love the new pas system but am still getting to grips with it.  
Can anyone offer any advice on the following...


Can I assign LDAP *groups* to Zope *groups*? and if so, how?


Currently, no. The LDAPMultiPlugin does not perform any mapping. You  
get the same group names that are stored in LDAP. Mapping of names is  
only available for roles, and it is set up at the LDAPUserFolder level.


jens


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFE5aWrRAx5nvEhZLIRAsZlAJ9xQniaz7QzQ3rCorWGmC4cFWgZWQCdHAvb
5ryy8K0TtTwcr1cWsY2PjBQ=
=5CZX
-END PGP SIGNATURE-
___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


[Zope-PAS] Authentication caching

2006-08-18 Thread Stefan H. Holek

Hi All,

I am in the lucky position of being sponsored to do some PAS work  
(Thanks WU-Wien!). You may see more coming from this direction soon. ;-)


As a first step I have implemented authentication caching in the  
gateway i.e. in _extractUserIds. If you want to have a look, you  
can find the code on the shh-authentication-caching branch.


http://svn.zope.org/PluggableAuthService/branches/shh-authentication- 
caching/


http://svn.zope.org/PluggableAuthService/branches/shh-authentication- 
caching/PluggableAuthService.py?rev=69485r1=69484r2=69485


Unless I receive complaints I am going to merge into trunk in a  
couple of days.


Cheers,
Stefan

--
Anything that, in happening, causes itself to happen again,
happens again.  --Douglas Adams


___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


RE: [Zope-PAS] Authentication caching

2006-08-18 Thread Ben Mason
That's great news and I don't have any objections. Any more work on PAS
gets a big thumbs up in my eyes!

Ben

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
 Behalf Of Stefan H. Holek
 Sent: 18 August 2006 13:40
 To: zope-pas@zope.org
 Subject: [Zope-PAS] Authentication caching
 
 Hi All,
 
 I am in the lucky position of being sponsored to do some PAS work
 (Thanks WU-Wien!). You may see more coming from this direction soon.
;-
 )
 
 As a first step I have implemented authentication caching in the
 gateway i.e. in _extractUserIds. If you want to have a look, you can
 find the code on the shh-authentication-caching branch.
 
 http://svn.zope.org/PluggableAuthService/branches/shh-authentication-
 caching/
 
 http://svn.zope.org/PluggableAuthService/branches/shh-authentication-
 caching/PluggableAuthService.py?rev=69485r1=69484r2=69485
 
 Unless I receive complaints I am going to merge into trunk in a couple
 of days.
 
 Cheers,
 Stefan
 
 --
 Anything that, in happening, causes itself to happen again, happens
 again.  --Douglas Adams
 
 
 ___
 Zope-PAS mailing list
 Zope-PAS@zope.org
 http://mail.zope.org/mailman/listinfo/zope-pas
___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


[Zope] Problem with Batch search

2006-08-18 Thread egf05
Hi,

I think I found a bug in the automatically generated Z Search Forms, as
described in the manual (16-4: Creating a search form for a ZCatalog). This
creates two files: SearchForm and SearchReport. SearchReport uses this method:

batch python:modules['ZTUtils'].Batch(results, size=20, start=start);

and then displays only 20 object rids per page. If it finds for instance 31
object, It gives a link to the Next 11 results. However, this is where it is
broken. Clicking on the link leads to have ALL objects in the catalog being
displayed. It now offers Previous 20 results / Next 20 results and you can
display all objects.

Is it a problem in Batch? or a bug in the SearchReport Page Template?

Thank you,
Eric

PS: This are the generated SearchReport Template:
htmlbody
html
  body tal:define=results  here/catalog;
start request/start|python:0;
batch python:modules['ZTUtils'].Batch(results, 
  size=20, 
  start=start);
previous python:batch.previous;
next python:batch.next

  p
a tal:condition=previous
   tal:attributes=href string:${request/URL0}?start:int=${previous/first}
   href=previous_urlprevious span
tal:replace=previous/length20/span results/a
a tal:condition=next
   tal:attributes=href string:${request/URL0}?start:int=${next/first}
   href=next_urlnext span tal:replace=next/length20/span 
results/a
  /p

  table border
tr
  thData record id /th
/tr
   
  tal:x repeat=result batch 
  
 tr
  tdspan tal:replace=result/data_record_id_data_record_id_ goes
here/span/td
/tr

  /tal:x

  /table
  p
a tal:condition=previous
   tal:attributes=href string:${request/URL0}?start:int=${previous/first}
   href=previous_urlprevious span
tal:replace=previous/length20/span results/a
a tal:condition=next
   tal:attributes=href string:${request/URL0}?start:int=${next/first}
   href=next_urlnext span tal:replace=next/length20/span 
results/a
  /p

  /body
/html

/body/html
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Problem with Batch search

2006-08-18 Thread egf05
Selon [EMAIL PROTECTED]:

 Hi,
 
 I think I found a bug in the automatically generated Z Search Forms, as
 described in the manual (16-4: Creating a search form for a ZCatalog). This
 creates two files: SearchForm and SearchReport. SearchReport uses this
 method:

I answer to myself because I think I found the rpoblem. The problem is that when
going to the next page, the query is not copied into the URL.
I corrected this way:

body tal:define=results  here/catalog;
start request/start|python:0;
batch python:modules['ZTUtils'].Batch(results,
  size=20,
  start=start);
previous python:batch.previous;
next python:batch.next;
textidx request/textidx


and:


p
a tal:condition=previous
   tal:attributes=href
string:${request/URL0}?start:int=${previous/first}textidx=${textidx}
   href=previous_urlprevious span
tal:replace=previous/lengthsize/span results/a
a tal:condition=next
   tal:attributes=href
string:${request/URL0}?start:int=${next/first}textidx=${textidx}
   href=next_urlnext span tal:replace=next/length20/span
results/a
   /p


Now it works.

Eric
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Trouble with PIL and Zope 2.8

2006-08-18 Thread Dan Gaibel

Hello group,

I am having problems with my PIL installation and I wonder if anyone  
has any ideas..


After what looked like a successful install of PIL 1.1.5 I am getting  
errors like encoder jpeg not available even though it looked like  
jpeg support compiled just fine in setup. Perhaps there is a special  
way to install PIL for use in Zope? Any advice is much appreciated.


What I'm working with:

Fedora Core 4
Python 2.3.5
Zope 2.8.6
PIL 1.1.5

Thanks!

Dan
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Trouble with PIL and Zope 2.8

2006-08-18 Thread Dennis Allison

Be sure that PIL is installed into the python you are using to run Zope.


On Fri, 18 Aug 2006, Dan Gaibel wrote:

 Hello group,
 
 I am having problems with my PIL installation and I wonder if anyone  
 has any ideas..
 
 After what looked like a successful install of PIL 1.1.5 I am getting  
 errors like encoder jpeg not available even though it looked like  
 jpeg support compiled just fine in setup. Perhaps there is a special  
 way to install PIL for use in Zope? Any advice is much appreciated.
 
 What I'm working with:
 
 Fedora Core 4
 Python 2.3.5
 Zope 2.8.6
 PIL 1.1.5
 
 Thanks!
 
 Dan
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )
 

-- 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Trouble with PIL and Zope 2.8

2006-08-18 Thread Andreas Jung



--On 18. August 2006 11:45:19 -0400 Dan Gaibel [EMAIL PROTECTED] wrote:


it looked like  jpeg
support compiled just fine in setup.


That's a vague description. Ensure you have libjpeg *including* all header 
files available. Ensure that the files are available in the common 
locations. If not adjust the setup.py script to your needs. There is some 
code that performs the necessary checks. Ensure that you compile with the 
Python binary that is used for your Zope interpreter.


-aj

pgpTnkqQEqtGN.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope 2.9 Product Refreshing

2006-08-18 Thread Peter Bengtsson


 What happens when you try to refresh a product?

Nothing. No errors, no refresh.

Then you should look in the SVN repository how the refresh code
changed.

   In Zope 2.8, refresh moves all modules starting with
   Products.product_to_be_refreshed out of sys.modules
   (and into a safe place) and then reimports the product.

   If there is an exception, the saved modules are restored.
   Otherwise, the ZODB is told to discard the connection cache
   when the connection is opened for the next time.

With this code, no errors, no refresh is impossible
(you get either an error or a refesh).

No really. My last comment was a big ambiguous.
The Refresh tab of the Control_Panel is does say Product refreshed.
(2006-08-18 18:33)
But it actually fails. It gets more complicated...



Of course, someone may have turned the refresh into a noop.
Then, you can try to reinstate the former code and see what
happens.


I've now done a lot of searching and diffs on the difference between
some zope286 and some zope294 code.
The modules I've looked at are:
ZODB.Connection.resetCaches() - no difference
ZODB.Connection - BIG difference (but is it applicable?)
OFS.Application - instead of zLOG-logger, tiny difference in raise
App.RefreshFuncs - instead of zLOG-logger

I've also compared the difference between python2.3 and python2.4's
__import__ builtin function and I can't see any difference.

On that note, I started my zope286 with python2.4 but refreshing was
still possible so zope2.9 requiring python2.4 does not seem to be the
reason.

I'm quite stuck right now. I haven't yet really dug into how
sys.modules work. The Zope code doesn't seem to have changed inside
the function import_product() of OFS.Application.

One last odd clue, when I refresh my product (eg. MyProduct) in zope
2.9.4, actual something happens. My product is very very simple and
it's one main class has a method called index_html() that looks like
this:


from DateTime import DateTime
   def index_html(self, REQUEST, RESPONSE):
 doc str 
return str(DateTime())

It works fine. After I manually refresh the product through the
Control_Panel, I get an error in index_html() because now 'DateTime'
has become None and thus can't be called with DateTime().
Does that help you help me?



--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope 2.9 Product Refreshing

2006-08-18 Thread Dieter Maurer
Peter Bengtsson wrote at 2006-8-18 18:53 +0100:
 ...
One last odd clue, when I refresh my product (eg. MyProduct) in zope
2.9.4, actual something happens. My product is very very simple and
it's one main class has a method called index_html() that looks like
this:


from DateTime import DateTime
def index_html(self, REQUEST, RESPONSE):
  doc str 
 return str(DateTime())

It works fine. After I manually refresh the product through the
Control_Panel, I get an error in index_html() because now 'DateTime'
has become None and thus can't be called with DateTime().
Does that help you help me?

Global variables apparently becoming None is a sign
that you are using an old (pre refresh) version of a function
(index_html in your case).

  When a module is released, some Python magic arranges that
  all its variables are rebound to None.

  When the function accesses one of its globals, it then appears as None.


If you have accessed the index_html via a persistent instance,
then the resetCaches seems not to have done what we expect
(it should have caused the connection cache to be dropped and
a new instance loaded from the storage with the new class definition).



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Python Scripts and HTML Forms

2006-08-18 Thread Muk Yan
Hi Jonathan,Thanks a lot, it works today, but it was acting up a bit yesterday. I really appreciate it, maybe I just needed to completely get rid of the browser cache.Peace and thanks again,Muk
On 8/17/06, Jonathan [EMAIL PROTECTED] wrote:







If you have a line like

input type=text name=first_name 
value=default value

in your html file then if you try the following in 
your script file

print REQUEST['first_name'] 
return printed

you should see default value printed 
out

you can try:

print REQUEST

to see the entire contents of REQUEST (very 
informative)

Note: if you do not have a default value in your 
input statement and you do not enter anything in the input field when 
the form is displayed, then when the form is submitted REQUEST will not contain 
an entry for the corresponding form field (an entry is made in REQUEST only when 
data is entered in the form field)


Jonathan



  - Original Message - 
  
From: 
  Muk Yan 
  To: 
Jonathan 
  Cc: 
zope@zope.org 
  Sent: Thursday, August 17, 2006 4:40 
  PM
  Subject: Re: [Zope] Python Scripts and 
  HTML Forms
  Hey All,Sorry about that, what I meant is that I get a 
  KeyError. It says that the first_name in REQUEST['first_name'] is not found, 
  when I try to set the variable in line in the script where fname = 
  REQUEST['first_name'].Thanks in 
  advance.Cheers,Muk
  On 8/17/06, Jonathan  
  [EMAIL PROTECTED] wrote:
  


What does it doesn't seem to work mean? 
Error messages/traceback? What does your form  script contain? 
More info on the problem is definitely required!




Jonathan



- 
Original Message - 

From: 
Muk Yan 

To: 
Jonathan ; 
zope@zope.org 
Sent: 
Thursday, August 17, 2006 4:20 PM
Subject: 
Re: [Zope] Python Scripts and HTML Forms
Hey Jonathan, All,Thanks I tried your solution, but 
it doesn't seem to work. Can anybody shed some more light on this 
situation, since what Jonathan provides is exactly what I want to do, but 
it's not working.Am I forgetting to put parameteres or some other 
newbie mistake like that?Thanks in advance and thanks again 
Jonathan.-Muk
On 8/17/06, Jonathan [EMAIL PROTECTED] wrote: 


  
  
  Form variables are stored in REQUEST. In a 
  python script you gain access to REQUEST by:
  
  REQUEST= 
  container.REQUEST
  you can then access the form variables 
  by:
  
  fname = REQUEST['first_name']
  
  
  you can check for the presence of a form 
  variable by
  
  if 
  REQUEST.has_key('first_name'):
  
  or
  
  if REQUEST.get('first_name', 
  None):
  
  
  hth
  
  Jonathan
  
  
  
  - 
  Original Message - 
  
From: 
  Muk Yan 
  To: 
  zope@zope.org 
  Sent: 
  Thursday, August 17, 2006 2:57 PM
  Subject: 
  [Zope] Python Scripts and HTML Forms
  Dear Trusted Zope Zealots,This subject was a bit 
  too broad to do a google search on, because I've tried and the lack of 
  relevancy was astounding.I've probably been committing a cardinal 
  sin in DTML, but I couldn't figure any other work around. I have 
  an HTML form in a DTML Document say:form 
  action="" method=postName:input type=text 
  name:first_name/form I want to use 
  first_name in a python script, but what I've been doing is setting it in 
  the process_this_form, which is a DTML method:DTML Method, 
  process_this_form:dtml-call REQUEST.SESSION.set ('firstName', 
  first_name)dtml-call 
  this_is_a_python_script()and in the Python Script, 
  this_is_a_python_scriptI use 
  REQUEST.SESSION.get('firstName')What my question is, is there 
  anyway to directly access first_name from the form in the python script 
  without having to have to call the dtml-call  
  REQUEST.SESSION.set('firstName', first_name) and then 
  REQUEST.SESSION.get('firstName') in the python script. Sort of a 
  sophomoric question, but any help would be appreciated. Thanks in 
  advance.-Muk
  
  
  

  ___Zope 
  maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope** 
  No cross posts or HTML encoding! **(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce 
   
  http://mail.zope.org/mailman/listinfo/zope-dev )
  



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


SOLVED! (was Re: [Zope] Content-Disposition is driving me batty)

2006-08-18 Thread Kirk Strauser
On Thursday 17 August 2006 10:55 am, David H wrote:

 I had similar problems too.  This seems to work with IE:
  theFile=open( self.pdfpath,'rb')
  result = theFile.read()
  
  RESPONSE.setHeader('Content-Type','application/pdf')
  RESPONSE.setHeader(Content-Disposition,filename=report.pdf)
  RESPONSE.setHeader('Content-Length',len(result))
  RESPONSE.write(result)

Sending the Content-Length header fixed the problem.  PDFs now appear 
inline and with their expected contents.  I haven't diffed the code between 
2.8 and 2.9, but I'm guessing that Zope used to send that header by default 
but no longer does.
-- 
Kirk Strauser
The Day Companies
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-DB] zope-db@zope.org

2006-08-18 Thread Roberto Benitez
Does anyone know where i can get a working database adapter for zope 2.8/2.9? 
		How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db