[Zope-Checkins] SVN: Zope/trunk/src/OFS/ - fixed handling of unicode ids

2012-07-20 Thread Yvo Schubbe
Log message for revision 127356:
  - fixed handling of unicode ids
  - related cleanup

Changed:
  U   Zope/trunk/src/OFS/ObjectManager.py
  U   Zope/trunk/src/OFS/tests/testObjectManager.py

-=-
Modified: Zope/trunk/src/OFS/ObjectManager.py
===
--- Zope/trunk/src/OFS/ObjectManager.py 2012-07-20 08:32:03 UTC (rev 127355)
+++ Zope/trunk/src/OFS/ObjectManager.py 2012-07-20 14:11:03 UTC (rev 127356)
@@ -501,34 +501,36 @@
 
 The objects specified in 'ids' get deleted.
 
-if type(ids) is type(''): ids=[ids]
+if isinstance(ids, basestring):
+ids = [ids]
 if not ids:
 return MessageDialog(title='No items specified',
message='No items were specified!',
-   action ='./manage_main',)
-try:p=self._reserved_names
-except: p=()
+   action='./manage_main',)
+try:
+p = self._reserved_names
+except:
+p = ()
 for n in ids:
 if n in p:
 return MessageDialog(title='Not Deletable',
message='EM%s/EM cannot be deleted.' % escape(n),
-   action ='./manage_main',)
+   action='./manage_main',)
 while ids:
-id=ids[-1]
-v=self._getOb(id, self)
+id = ids[-1]
+v = self._getOb(id, self)
 
 if v.wl_isLocked():
-raise ResourceLockedError, (
+raise ResourceLockedError(
 'Object %s is locked via WebDAV' % v.getId())
 
 if v is self:
-raise BadRequest, '%s does not exist' % escape(ids[-1])
+raise BadRequest('%s does not exist' % escape(ids[-1]))
 self._delObject(id)
 del ids[-1]
 if REQUEST is not None:
 return self.manage_main(self, REQUEST, update_menu=1)
 
-
 def tpValues(self):
 # Return a list of subobjects, used by tree tag.
 r=[]

Modified: Zope/trunk/src/OFS/tests/testObjectManager.py
===
--- Zope/trunk/src/OFS/tests/testObjectManager.py   2012-07-20 08:32:03 UTC 
(rev 127355)
+++ Zope/trunk/src/OFS/tests/testObjectManager.py   2012-07-20 14:11:03 UTC 
(rev 127356)
@@ -6,7 +6,6 @@
 from AccessControl.SecurityManager import setSecurityPolicy
 from AccessControl.SpecialUsers import emergency_user, nobody, system
 from AccessControl.User import User # before SpecialUsers
-from Acquisition import aq_base
 from Acquisition import Implicit
 from App.config import getConfiguration
 from logging import getLogger
@@ -258,7 +257,7 @@
 om._delObject(ob.getId())
 finally:
 logger.disabled = 0
-
+
 def test_delObject_exception_debug_manager(self):
 # Test exception behavior in manage_beforeDelete in debug mode
 # Manager user
@@ -303,6 +302,21 @@
 finally:
 logger.disabled = 0
 
+def test_manage_delObjects(self):
+om = self._makeOne()
+ob = ItemForDeletion()
+om._setObject('stuff', ob)
+om.manage_delObjects('stuff')
+self.assertFalse('stuff' in om)
+
+om._setObject('stuff', ob)
+om.manage_delObjects(['stuff'])
+self.assertFalse('stuff' in om)
+
+om._setObject('stuff', ob)
+om.manage_delObjects(u'stuff')
+self.assertFalse('stuff' in om)
+
 def test_hasObject(self):
 om = self._makeOne()
 self.assertFalse(om.hasObject('_properties'))

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


[Zope-Checkins] SVN: Zope/trunk/src/ - updated imports

2012-07-18 Thread Yvo Schubbe
Log message for revision 127347:
  - updated imports

Changed:
  U   Zope/trunk/src/OFS/ObjectManager.py
  UU  Zope/trunk/src/OFS/event.py
  UU  Zope/trunk/src/OFS/interfaces.py
  U   Zope/trunk/src/OFS/tests/event.txt
  U   Zope/trunk/src/OFS/tests/testCopySupportEvents.py
  UU  Zope/trunk/src/Products/Five/browser/tests/test_pagetemplatefile.py
  U   Zope/trunk/src/Products/Five/component/__init__.py
  U   Zope/trunk/src/Products/Five/component/component.txt
  U   Zope/trunk/src/Products/Five/component/makesite.txt
  UU  Zope/trunk/src/Products/Five/viewlet/manager.py

-=-
Modified: Zope/trunk/src/OFS/ObjectManager.py
===
--- Zope/trunk/src/OFS/ObjectManager.py 2012-07-16 09:25:46 UTC (rev 127346)
+++ Zope/trunk/src/OFS/ObjectManager.py 2012-07-18 07:06:13 UTC (rev 127347)
@@ -50,12 +50,12 @@
 from webdav.Lockable import ResourceLockedError
 from webdav.NullResource import NullResource
 from zExceptions import BadRequest
+from zope.container.contained import notifyContainerModified
+from zope.event import notify
 from zope.interface import implements
-from zope.component.interfaces import ComponentLookupError
-from zope.event import notify
+from zope.interface.interfaces import ComponentLookupError
 from zope.lifecycleevent import ObjectAddedEvent
 from zope.lifecycleevent import ObjectRemovedEvent
-from zope.container.contained import notifyContainerModified
 
 from OFS.CopySupport import CopyContainer
 from OFS.interfaces import IObjectManager

Modified: Zope/trunk/src/OFS/event.py
===
--- Zope/trunk/src/OFS/event.py 2012-07-16 09:25:46 UTC (rev 127346)
+++ Zope/trunk/src/OFS/event.py 2012-07-18 07:06:13 UTC (rev 127347)
@@ -16,11 +16,12 @@
 
 
 from zope.interface import implements
-from zope.component.interfaces import ObjectEvent
+from zope.interface.interfaces import ObjectEvent
 import OFS.interfaces
 
 
 class ObjectWillBeMovedEvent(ObjectEvent):
+
 An object will be moved.
 implements(OFS.interfaces.IObjectWillBeMovedEvent)
 
@@ -31,7 +32,9 @@
 self.newParent = newParent
 self.newName = newName
 
+
 class ObjectWillBeAddedEvent(ObjectWillBeMovedEvent):
+
 An object will be added to a container.
 implements(OFS.interfaces.IObjectWillBeAddedEvent)
 
@@ -43,7 +46,9 @@
 ObjectWillBeMovedEvent.__init__(self, object, None, None,
 newParent, newName)
 
+
 class ObjectWillBeRemovedEvent(ObjectWillBeMovedEvent):
+
 An object will be removed from a container.
 implements(OFS.interfaces.IObjectWillBeRemovedEvent)
 
@@ -55,6 +60,8 @@
 ObjectWillBeMovedEvent.__init__(self, object, oldParent, oldName,
 None, None)
 
+
 class ObjectClonedEvent(ObjectEvent):
+
 An object has been cloned into a container.
 implements(OFS.interfaces.IObjectClonedEvent)


Property changes on: Zope/trunk/src/OFS/event.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/OFS/interfaces.py
===
--- Zope/trunk/src/OFS/interfaces.py2012-07-16 09:25:46 UTC (rev 127346)
+++ Zope/trunk/src/OFS/interfaces.py2012-07-18 07:06:13 UTC (rev 127347)
@@ -17,6 +17,7 @@
 from zope.container.interfaces import IContainer
 from zope.interface import Attribute
 from zope.interface import Interface
+from zope.interface.interfaces import IObjectEvent
 from zope.location.interfaces import IRoot
 from zope.schema import Bool, BytesLine, Tuple
 
@@ -871,8 +872,6 @@
 ##
 # Event interfaces
 
-from zope.component.interfaces import IObjectEvent
-
 class IObjectWillBeMovedEvent(IObjectEvent):
 An object will be moved.
 oldParent = Attribute(The old location parent for the object.)
@@ -880,12 +879,15 @@
 newParent = Attribute(The new location parent for the object.)
 newName = Attribute(The new location name for the object.)
 
+
 class IObjectWillBeAddedEvent(IObjectWillBeMovedEvent):
 An object will be added to a container.
 
+
 class IObjectWillBeRemovedEvent(IObjectWillBeMovedEvent):
 An object will be removed from a container
 
+
 class IObjectClonedEvent(IObjectEvent):
 An object has been cloned (a la Zope 2).
 


Property changes on: Zope/trunk/src/OFS/interfaces.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/OFS/tests/event.txt
===
--- Zope/trunk/src/OFS/tests/event.txt  2012-07-16 09:25:46 UTC (rev 127346)
+++ Zope/trunk/src/OFS/tests/event.txt  2012-07-18 07:06:13 UTC (rev 127347)
@@ -51,12 +51,13 @@
 framework's ones, so ours will be called first. This has the effect that
 printed events will be in their natural order::
 
-   

[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.rst - tweaking

2012-07-11 Thread Yvo Schubbe
Log message for revision 127325:
  - tweaking

Changed:
  U   Zope/trunk/doc/CHANGES.rst

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2012-07-11 14:29:44 UTC (rev 127324)
+++ Zope/trunk/doc/CHANGES.rst  2012-07-11 18:16:10 UTC (rev 127325)
@@ -40,10 +40,6 @@
 Features Added
 ++
 
-- Five: Refactored ``browser:view`` and ``browser:page`` directives.
-  This makes their implementation more similar to that in ``zope.browserpage``
-  and adds allowed_interface support for the ``browser:view`` directive.
-
 - Optimized the `OFS.Traversable.getPhysicalPath` method to avoid excessive
   amounts of method calls.
 
@@ -77,6 +73,12 @@
 Restructuring
 +
 
+- Five: Refactored ``browser:view`` and ``browser:page`` directives.
+  This makes their implementation more similar to that in ``zope.browserpage``
+  and adds allowed_interface support for the ``browser:view`` directive.
+  By default the `aq_*` attributes are no longer available on those
+  views/pages. If you still use them, you have to mix in Five's BrowserView.
+
 - Removed the (very obsolete) thread lock around the cookie parsing code
   in HTTPRequest.py; the python `re` module is thread-safe, unlike the
   ancient `regex` module that was once used here.

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/resource.py - tweaking

2012-07-11 Thread Yvo Schubbe
Log message for revision 127326:
  - tweaking

Changed:
  U   Zope/trunk/src/Products/Five/browser/resource.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/resource.py
===
--- Zope/trunk/src/Products/Five/browser/resource.py2012-07-11 18:16:10 UTC 
(rev 127325)
+++ Zope/trunk/src/Products/Five/browser/resource.py2012-07-11 18:21:07 UTC 
(rev 127326)
@@ -73,8 +73,9 @@
 class FileResource(Resource, zope.browserresource.file.FileResource):
 pass
 
-class ResourceFactory:
 
+class ResourceFactory(object):
+
 factory = None
 resource = None
 

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/ - added more security tests

2012-07-11 Thread Yvo Schubbe
Log message for revision 127327:
  - added more security tests
  - fixed __ac_permissions__ created by the browser:view directive

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py
  U   Zope/trunk/src/Products/Five/browser/tests/pages.py
  U   Zope/trunk/src/Products/Five/browser/tests/pages.txt
  U   Zope/trunk/src/Products/Five/browser/tests/pages.zcml

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-11 
18:21:07 UTC (rev 127326)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-11 
18:31:54 UTC (rev 127327)
@@ -262,6 +262,7 @@
 )
 
 if class_ is not None:
+cdict.update(getSecurityInfo(class_))
 bases = (class_, simple)
 else:
 bases = (simple,)

Modified: Zope/trunk/src/Products/Five/browser/tests/pages.py
===
--- Zope/trunk/src/Products/Five/browser/tests/pages.py 2012-07-11 18:21:07 UTC 
(rev 127326)
+++ Zope/trunk/src/Products/Five/browser/tests/pages.py 2012-07-11 18:31:54 UTC 
(rev 127327)
@@ -14,9 +14,11 @@
 Test browser pages
 
 
+from AccessControl.class_init import InitializeClass
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from OFS.SimpleItem import SimpleItem
 from Products.Five import BrowserView
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-from OFS.SimpleItem import SimpleItem
 
 
 class SimpleView(BrowserView):
@@ -96,3 +98,25 @@
 def method(self):
 Docstring
 return
+
+
+class ProtectedView(object):
+
+security = ClassSecurityInfo()
+
+security.declarePublic('public_method')
+def public_method(self):
+Docstring
+return u'PUBLIC'
+
+security.declareProtected('View', 'protected_method')
+def protected_method(self):
+Docstring
+return u'PROTECTED'
+
+security.declarePrivate('private_method')
+def private_method(self):
+Docstring
+return u'PRIVATE'
+
+InitializeClass(ProtectedView)

Modified: Zope/trunk/src/Products/Five/browser/tests/pages.txt
===
--- Zope/trunk/src/Products/Five/browser/tests/pages.txt2012-07-11 
18:21:07 UTC (rev 127326)
+++ Zope/trunk/src/Products/Five/browser/tests/pages.txt2012-07-11 
18:31:54 UTC (rev 127327)
@@ -319,7 +319,53 @@
   htmlbodyimg alt=

src=http://nohost/test_folder_1_/testoid/++resource++pattern.png; 
//body/html
 
+Security settings of the base class are combined with new settings based on the
+view permission:
 
+   from AccessControl import ACCESS_PUBLIC
+   view = self.folder.unrestrictedTraverse('testoid/protected_class_page')
+   view.__parent__ == self.folder.testoid
+  True
+   view.__ac_permissions__
+  (('View', ('protected_method',)), ('View management screens', ('', 
'__call__')))
+   aq_acquire(view, '__callroles__')
+  ('Manager',)
+   aq_acquire(view, 'public_method__roles__') is ACCESS_PUBLIC
+  True
+   aq_acquire(view, 'protected_method__roles__')
+  ['Manager', 'test_role_1_', 'Manager', 'Anonymous']
+   aq_acquire(view, 'private_method__roles__') is ACCESS_PRIVATE
+  True
+
+   view = 
self.folder.unrestrictedTraverse('testoid/protected_template_class_page')
+   view.__parent__ == self.folder.testoid
+  True
+   view.__ac_permissions__
+  (('View', ('protected_method',)), ('View management screens', ('', 
'__call__')))
+   aq_acquire(view, '__callroles__')
+  ('Manager',)
+   aq_acquire(view, 'public_method__roles__') is ACCESS_PUBLIC
+  True
+   aq_acquire(view, 'protected_method__roles__')
+  ['Manager', 'test_role_1_', 'Manager', 'Anonymous']
+   aq_acquire(view, 'private_method__roles__') is ACCESS_PRIVATE
+  True
+
+   view = self.folder.unrestrictedTraverse('testoid/protected_class_view')
+   view.__parent__ == self.folder.testoid
+  True
+   view.__ac_permissions__
+  (('View', ('protected_method',)), ('View management screens', ('',)))
+   getattr(view, '__callroles__', False)
+  False
+   aq_acquire(view, 'public_method__roles__') is ACCESS_PUBLIC
+  True
+   aq_acquire(view, 'protected_method__roles__')
+  ['Manager', 'test_role_1_', 'Manager', 'Anonymous']
+   aq_acquire(view, 'private_method__roles__') is ACCESS_PRIVATE
+  True
+
+
 Clean up
 
 

Modified: Zope/trunk/src/Products/Five/browser/tests/pages.zcml
===
--- Zope/trunk/src/Products/Five/browser/tests/pages.zcml   2012-07-11 
18:21:07 UTC (rev 127326)
+++ Zope/trunk/src/Products/Five/browser/tests/pages.zcml   2012-07-11 
18:31:54 UTC (rev 127327)
@@ -250,4 +250,28 @@
   permission=zope2.Public
   /
 
+  !-- views with protected methods --
+
+  browser:page
+  

[Zope-Checkins] SVN: Zope/trunk/src/Products/Sessions/tests/testSessionDataManager.py - trying to improve the tearDown (sometimes I see random errors in these tests)

2012-07-11 Thread Yvo Schubbe
Log message for revision 127329:
  - trying to improve the tearDown (sometimes I see random errors in these 
tests)

Changed:
  U   Zope/trunk/src/Products/Sessions/tests/testSessionDataManager.py

-=-
Modified: Zope/trunk/src/Products/Sessions/tests/testSessionDataManager.py
===
--- Zope/trunk/src/Products/Sessions/tests/testSessionDataManager.py
2012-07-11 18:33:35 UTC (rev 127328)
+++ Zope/trunk/src/Products/Sessions/tests/testSessionDataManager.py
2012-07-11 18:40:24 UTC (rev 127329)
@@ -108,6 +108,7 @@
 
 def tearDown(self):
 _delDB()
+self.app._p_jar.close()
 del self.app
 
 def testHasId(self):

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - more syncing with zope.browserpage

2012-07-11 Thread Yvo Schubbe
Log message for revision 127331:
  - more syncing with zope.browserpage

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-11 
19:11:56 UTC (rev 127330)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-11 
19:25:03 UTC (rev 127331)
@@ -18,14 +18,17 @@
 
 
 import os
+import sys
 from inspect import ismethod
 
 from zope.component import queryMultiAdapter
 from zope.component.interface import provideInterface
 from zope.component.zcml import handler
 from zope.configuration.exceptions import ConfigurationError
+from zope.interface import classImplements
 from zope.interface import Interface
 from zope.publisher.interfaces import NotFound
+from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.security.zcml import Permission
@@ -122,14 +125,17 @@
 # class and template
 new_class = SimpleViewClass(template, bases=(class_, ), name=name)
 else:
-cdict = getSecurityInfo(class_)
 if not hasattr(class_, 'browserDefault'):
-cdict.update({
+cdict = {
 'browserDefault':
 lambda self, request: (getattr(self, attribute), ())
-})
+}
+else:
+cdict = {}
+
 cdict['__name__'] = name
 cdict['__page_attribute__'] = attribute
+cdict.update(getSecurityInfo(class_))
 new_class = type(class_.__name__, (class_, simple,), cdict)
 
 if attribute != __call__:
@@ -146,6 +152,9 @@
 func = func.im_func
 func.__doc__ = Stub docstring to make ZPublisher work
 
+if hasattr(class_, '__implements__'):
+classImplements(new_class, IBrowserPublisher)
+
 else:
 # template
 new_class = SimpleViewClass(template, name=name)
@@ -444,16 +453,17 @@
 
 # Original version: zope.browserpage.simpleviewclass.SimpleViewClass
 def SimpleViewClass(src, offering=None, used_for=None, bases=(), name=u''):
-if bases:
-cdict = getSecurityInfo(bases[0])
-else:
-cdict = {}
-cdict.update({'index': ViewPageTemplateFile(src, offering),
-  '__name__': name})
+if offering is None:
+offering = sys._getframe(1).f_globals
 
 bases += (ViewMixinForTemplates,)
 
-class_ = type(SimpleViewClass from %s % src, bases, cdict)
+cdict = {'index': ViewPageTemplateFile(src, offering),
+ '__name__': name}
+if bases:
+cdict.update(getSecurityInfo(bases[0]))
+class_ = type(SimpleViewClass from %s % src, bases,
+  cdict)
 
 if used_for is not None:
 class_.__used_for__ = used_for

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


[Zope-Checkins] SVN: Zope/branches/2.13/ - fixed TypeError handling in unrestrictedTraverse

2012-07-10 Thread Yvo Schubbe
Log message for revision 127292:
  - fixed TypeError handling in unrestrictedTraverse

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/OFS/Traversable.py
  UU  Zope/branches/2.13/src/OFS/tests/testTraverse.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2012-07-10 06:29:24 UTC (rev 127291)
+++ Zope/branches/2.13/doc/CHANGES.rst  2012-07-10 06:48:11 UTC (rev 127292)
@@ -8,6 +8,8 @@
 2.13.16 (unreleased)
 
 
+- OFS: Fixed TypeError handling in unrestrictedTraverse.
+
 - Updated distributions:
 
   - AccessControl = 2.13.8

Modified: Zope/branches/2.13/src/OFS/Traversable.py
===
--- Zope/branches/2.13/src/OFS/Traversable.py   2012-07-10 06:29:24 UTC (rev 
127291)
+++ Zope/branches/2.13/src/OFS/Traversable.py   2012-07-10 06:48:11 UTC (rev 
127292)
@@ -260,9 +260,10 @@
 if isinstance(next, NullResource):
 resource = next
 raise KeyError(name)
-except AttributeError:
+except (AttributeError, TypeError):
 # Raise NotFound for easier debugging
 # instead of AttributeError: __getitem__
+# or TypeError: not subscriptable
 raise NotFound(name)
 if restricted and not validate(
 obj, obj, None, next):


Property changes on: Zope/branches/2.13/src/OFS/Traversable.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/branches/2.13/src/OFS/tests/testTraverse.py
===
--- Zope/branches/2.13/src/OFS/tests/testTraverse.py2012-07-10 06:29:24 UTC 
(rev 127291)
+++ Zope/branches/2.13/src/OFS/tests/testTraverse.py2012-07-10 06:48:11 UTC 
(rev 127292)
@@ -402,6 +402,20 @@
 self.assertEqual(
 self.root.folder1.restrictedTraverse('stuff', 42), 42)
 
+def testNotFoundIsRaised(self):
+from OFS.SimpleItem import SimpleItem
+from zExceptions import NotFound
+from operator import getitem
+self.folder1._setObject('foo', SimpleItem('foo'))
+self.assertRaises(AttributeError, getitem, self.folder1.foo,
+  'doesntexist')
+self.assertRaises(NotFound, self.folder1.unrestrictedTraverse,
+  'foo/doesntexist')
+self.assertRaises(TypeError, getitem,
+  self.folder1.foo.isPrincipiaFolderish, 'doesntexist')
+self.assertRaises(NotFound, self.folder1.unrestrictedTraverse,
+  'foo/isPrincipiaFolderish/doesntexist')
+
 def testDefaultValueWhenNotFound(self):
 # Test that traversing to a non-existent object returns
 # the default when provided


Property changes on: Zope/branches/2.13/src/OFS/tests/testTraverse.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/trunk/src/OFS/ - fixed TypeError handling in unrestrictedTraverse

2012-07-10 Thread Yvo Schubbe
Log message for revision 127293:
  - fixed TypeError handling in unrestrictedTraverse

Changed:
  UU  Zope/trunk/src/OFS/Traversable.py
  UU  Zope/trunk/src/OFS/tests/testTraverse.py

-=-
Modified: Zope/trunk/src/OFS/Traversable.py
===
--- Zope/trunk/src/OFS/Traversable.py   2012-07-10 06:48:11 UTC (rev 127292)
+++ Zope/trunk/src/OFS/Traversable.py   2012-07-10 06:48:48 UTC (rev 127293)
@@ -284,9 +284,10 @@
 if isinstance(next, NullResource):
 resource = next
 raise KeyError(name)
-except AttributeError:
+except (AttributeError, TypeError):
 # Raise NotFound for easier debugging
 # instead of AttributeError: __getitem__
+# or TypeError: not subscriptable
 raise NotFound(name)
 if restricted and not validate(
 obj, obj, None, next):


Property changes on: Zope/trunk/src/OFS/Traversable.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/OFS/tests/testTraverse.py
===
--- Zope/trunk/src/OFS/tests/testTraverse.py2012-07-10 06:48:11 UTC (rev 
127292)
+++ Zope/trunk/src/OFS/tests/testTraverse.py2012-07-10 06:48:48 UTC (rev 
127293)
@@ -402,6 +402,20 @@
 self.assertEqual(
 self.root.folder1.restrictedTraverse('stuff', 42), 42)
 
+def testNotFoundIsRaised(self):
+from OFS.SimpleItem import SimpleItem
+from zExceptions import NotFound
+from operator import getitem
+self.folder1._setObject('foo', SimpleItem('foo'))
+self.assertRaises(AttributeError, getitem, self.folder1.foo,
+  'doesntexist')
+self.assertRaises(NotFound, self.folder1.unrestrictedTraverse,
+  'foo/doesntexist')
+self.assertRaises(TypeError, getitem,
+  self.folder1.foo.isPrincipiaFolderish, 'doesntexist')
+self.assertRaises(NotFound, self.folder1.unrestrictedTraverse,
+  'foo/isPrincipiaFolderish/doesntexist')
+
 def testDefaultValueWhenNotFound(self):
 # Test that traversing to a non-existent object returns
 # the default when provided


Property changes on: Zope/trunk/src/OFS/tests/testTraverse.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/ - use the same constructor names and signatures as in zope.browserpage

2012-07-10 Thread Yvo Schubbe
Log message for revision 127295:
  - use the same constructor names and signatures as in zope.browserpage

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py
  U   Zope/trunk/src/Products/Five/viewlet/README.txt

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:27:26 UTC (rev 127294)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:35:00 UTC (rev 127295)
@@ -125,16 +125,13 @@
 cdict['__name__'] = name
 if template:
 # class and template
-new_class = makeClassForTemplate(template, bases=(class_, ),
- cdict=cdict, name=name)
+new_class = SimpleViewClass(template, bases=(class_, ), name=name)
 elif attribute != __call__:
 # we're supposed to make a page for an attribute (read:
 # method) and it's not __call__.  We thus need to create a
 # new class using our mixin for attributes.
 cdict.update({'__page_attribute__': attribute})
-new_class = makeClass(class_.__name__,
-  (class_, ViewMixinForAttributes),
-  cdict)
+new_class = makeClass(class_.__name__, (class_, simple), cdict)
 
 # in case the attribute does not provide a docstring,
 # ZPublisher refuses to publish it.  So, as a workaround,
@@ -158,7 +155,7 @@
 
 else:
 # template
-new_class = makeClassForTemplate(template, name=name)
+new_class = SimpleViewClass(template, name=name)
 
 for n in ('', attribute):
 required[n] = permission
@@ -428,8 +425,7 @@
 )
 
 
-class ViewMixinForAttributes(BrowserView,
- zope.browserpage.metaconfigure.simple):
+class simple(BrowserView, zope.browserpage.metaconfigure.simple):
 
 # XXX: this alternative implementation would support permission checks for
 #  the attribute instead of the view
@@ -471,16 +467,20 @@
 def __call__(self, *args, **kw):
 return self.index(*args, **kw)
 
-def makeClassForTemplate(filename, globals=None, used_for=None,
- bases=(), cdict=None, name=u''):
-# XXX needs to deal with security from the bases?
-if cdict is None:
+
+# Original version: zope.browserpage.simpleviewclass.SimpleViewClass
+def SimpleViewClass(src, offering=None, used_for=None, bases=(), name=u''):
+if bases:
+cdict = getSecurityInfo(bases[0])
+else:
 cdict = {}
-cdict.update({'index': ViewPageTemplateFile(filename, globals),
+cdict.update({'index': ViewPageTemplateFile(src, offering),
   '__name__': name})
+
 bases += (ViewMixinForTemplates,)
-class_ = makeClass(SimpleViewClass from %s % filename, bases, cdict)
 
+class_ = makeClass(SimpleViewClass from %s % src, bases, cdict)
+
 if used_for is not None:
 class_.__used_for__ = used_for
 

Modified: Zope/trunk/src/Products/Five/viewlet/README.txt
===
--- Zope/trunk/src/Products/Five/viewlet/README.txt 2012-07-10 12:27:26 UTC 
(rev 127294)
+++ Zope/trunk/src/Products/Five/viewlet/README.txt 2012-07-10 12:35:00 UTC 
(rev 127295)
@@ -484,8 +484,8 @@
   ... /html
   ... ''')
 
-   from Products.Five.browser.metaconfigure import makeClassForTemplate
-   Contents = makeClassForTemplate(contentsTemplate, name='contents.html')
+   from Products.Five.browser.metaconfigure import SimpleViewClass
+   Contents = SimpleViewClass(contentsTemplate, name='contents.html')
 
 
 The Viewlet Manager

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - subclass from zope.browserpage.simpleviewclass.simple

2012-07-10 Thread Yvo Schubbe
Log message for revision 127296:
  - subclass from zope.browserpage.simpleviewclass.simple

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:35:00 UTC (rev 127295)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:41:52 UTC (rev 127296)
@@ -24,15 +24,14 @@
 from zope.component.interface import provideInterface
 from zope.component.zcml import handler
 from zope.configuration.exceptions import ConfigurationError
-from zope.interface import implements
 from zope.interface import Interface
 from zope.publisher.interfaces import NotFound
-from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.security.zcml import Permission
 
 import zope.browserpage.metaconfigure
+import zope.browserpage.simpleviewclass
 from zope.browserpage.metaconfigure import _handle_allowed_attributes
 from zope.browserpage.metaconfigure import _handle_allowed_interface
 from zope.browserpage.metaconfigure import _handle_for
@@ -446,28 +445,15 @@
 return getattr(self, self.__page_attribute__)
 
 
-class ViewMixinForTemplates(BrowserView):
-# Cloned from zope.app.pagetemplate.simpleviewclass.simple
-implements(IBrowserPublisher)
+class ViewMixinForTemplates(BrowserView,
+zope.browserpage.simpleviewclass.simple):
 
-def browserDefault(self, request):
-return self, ()
-
-def publishTraverse(self, request, name):
-if name == 'index.html':
-return self.index
-
-raise NotFound(self, name, request)
-
 def __getitem__(self, name):
 if name == 'macros':
 return self.index.macros
 return self.index.macros[name]
 
-def __call__(self, *args, **kw):
-return self.index(*args, **kw)
 
-
 # Original version: zope.browserpage.simpleviewclass.SimpleViewClass
 def SimpleViewClass(src, offering=None, used_for=None, bases=(), name=u''):
 if bases:

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - fixed mixin class used by the view directive

2012-07-10 Thread Yvo Schubbe
Log message for revision 127297:
  - fixed mixin class used by the view directive
  (Looks like someone mixed up zope.browserpage.metaconfigure.simple and 
zope.browserpage.simpleviewclass.simple. Doesn't make a big difference here, 
but zope.browserpage uses the other one in this place.)

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:41:52 UTC (rev 127296)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:50:33 UTC (rev 127297)
@@ -267,9 +267,9 @@
 )
 
 if class_ is not None:
-bases = (class_, ViewMixinForTemplates)
+bases = (class_, simple)
 else:
-bases = (ViewMixinForTemplates,)
+bases = (simple,)
 
 try:
 cname = str(name)

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/ - use the same base class for __call__ and other attributes

2012-07-10 Thread Yvo Schubbe
Log message for revision 127298:
  - use the same base class for __call__ and other attributes

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py
  U   Zope/trunk/src/Products/Five/browser/tests/pages_ftest.txt

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
12:50:33 UTC (rev 127297)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
13:05:08 UTC (rev 127298)
@@ -129,7 +129,7 @@
 # we're supposed to make a page for an attribute (read:
 # method) and it's not __call__.  We thus need to create a
 # new class using our mixin for attributes.
-cdict.update({'__page_attribute__': attribute})
+cdict['__page_attribute__'] = attribute
 new_class = makeClass(class_.__name__, (class_, simple), cdict)
 
 # in case the attribute does not provide a docstring,
@@ -149,8 +149,8 @@
 # some security declarations on it so we really shouldn't
 # modify the original.  So, instead we make a new class
 # with just one base class -- the original
-new_class = makeClass(class_.__name__,
-  (class_, BrowserView), cdict)
+cdict['__page_attribute__'] = attribute
+new_class = makeClass(class_.__name__, (class_, simple), cdict)
 
 else:
 # template

Modified: Zope/trunk/src/Products/Five/browser/tests/pages_ftest.txt
===
--- Zope/trunk/src/Products/Five/browser/tests/pages_ftest.txt  2012-07-10 
12:50:33 UTC (rev 127297)
+++ Zope/trunk/src/Products/Five/browser/tests/pages_ftest.txt  2012-07-10 
13:05:08 UTC (rev 127298)
@@ -86,7 +86,7 @@
 
response = self.publish('/test_folder_1_/testoid/eagle.method/mouse',
   ... basic='viewer:secret')
-   self.assertEqual(response.getStatus(), 401)
+   self.assertEqual(response.getStatus(), 404)
 
 The same should apply for the user if he has all other permissions
 except 'View management screens':

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - now we can simplify that code a bit

2012-07-10 Thread Yvo Schubbe
Log message for revision 127299:
  - now we can simplify that code a bit

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
13:05:08 UTC (rev 127298)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
13:12:59 UTC (rev 127299)
@@ -120,38 +120,29 @@
 raise ConfigurationError(
 The provided class doesn't have the specified attribute 
 )
-cdict = getSecurityInfo(class_)
-cdict['__name__'] = name
 if template:
 # class and template
 new_class = SimpleViewClass(template, bases=(class_, ), name=name)
-elif attribute != __call__:
-# we're supposed to make a page for an attribute (read:
-# method) and it's not __call__.  We thus need to create a
-# new class using our mixin for attributes.
-cdict['__page_attribute__'] = attribute
-new_class = makeClass(class_.__name__, (class_, simple), cdict)
-
-# in case the attribute does not provide a docstring,
-# ZPublisher refuses to publish it.  So, as a workaround,
-# we provide a stub docstring
-func = getattr(new_class, attribute)
-if not func.__doc__:
-# cannot test for MethodType/UnboundMethod here
-# because of ExtensionClass
-if hasattr(func, 'im_func'):
-# you can only set a docstring on functions, not
-# on method objects
-func = func.im_func
-func.__doc__ = Stub docstring to make ZPublisher work
 else:
-# we could use the class verbatim here, but we'll execute
-# some security declarations on it so we really shouldn't
-# modify the original.  So, instead we make a new class
-# with just one base class -- the original
+cdict = getSecurityInfo(class_)
+cdict['__name__'] = name
 cdict['__page_attribute__'] = attribute
 new_class = makeClass(class_.__name__, (class_, simple), cdict)
 
+if attribute != __call__:
+# in case the attribute does not provide a docstring,
+# ZPublisher refuses to publish it.  So, as a workaround,
+# we provide a stub docstring
+func = getattr(new_class, attribute)
+if not func.__doc__:
+# cannot test for MethodType/UnboundMethod here
+# because of ExtensionClass
+if hasattr(func, 'im_func'):
+# you can only set a docstring on functions, not
+# on method objects
+func = func.im_func
+func.__doc__ = Stub docstring to make ZPublisher work
+
 else:
 # template
 new_class = SimpleViewClass(template, name=name)

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - fixed simple class

2012-07-10 Thread Yvo Schubbe
Log message for revision 127300:
  - fixed simple class
  - removed Five BrowserView as base class
  (trying to move one more step forward instead of reverting revision 127298 
and 127299 which did break CMF tests)

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
13:12:59 UTC (rev 127299)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-10 
13:57:06 UTC (rev 127300)
@@ -46,7 +46,6 @@
 from AccessControl.security import protectName
 from AccessControl.security import CheckerPrivateId
 
-from Products.Five.browser import BrowserView
 from Products.Five.browser.resource import FileResourceFactory
 from Products.Five.browser.resource import ImageResourceFactory
 from Products.Five.browser.resource import PageTemplateResourceFactory
@@ -125,6 +124,11 @@
 new_class = SimpleViewClass(template, bases=(class_, ), name=name)
 else:
 cdict = getSecurityInfo(class_)
+if not hasattr(class_, 'browserDefault'):
+cdict.update({
+'browserDefault':
+lambda self, request: (getattr(self, attribute), ())
+})
 cdict['__name__'] = name
 cdict['__page_attribute__'] = attribute
 new_class = makeClass(class_.__name__, (class_, simple), cdict)
@@ -415,30 +419,23 @@
 )
 
 
-class simple(BrowserView, zope.browserpage.metaconfigure.simple):
+class simple(zope.browserpage.metaconfigure.simple):
 
-# XXX: this alternative implementation would support permission checks for
-#  the attribute instead of the view
-# def browserDefault(self, request):
-# return self, (self.__page_attribute__,)
-#
-# def publishTraverse(self, request, name):
-# return getattr(self, name)
-
-# For some reason, the 'simple' baseclass doesn't implement this
-# mandatory method (see https://bugs.launchpad.net/zope3/+bug/129296)
-def browserDefault(self, request):
-return getattr(self, self.__page_attribute__), ()
-
 # __call__ should have the same signature as the original method
 @property
 def __call__(self):
-return getattr(self, self.__page_attribute__)
+# If a class doesn't provide it's own call, then get the attribute
+# given by the browser default.
 
+attr = self.__page_attribute__
+if attr == '__call__':
+raise AttributeError(__call__)
 
-class ViewMixinForTemplates(BrowserView,
-zope.browserpage.simpleviewclass.simple):
+return getattr(self, attr)
 
+
+class ViewMixinForTemplates(zope.browserpage.simpleviewclass.simple):
+
 def __getitem__(self, name):
 if name == 'macros':
 return self.index.macros

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


[Zope-Checkins] SVN: Zope/trunk/ - refactored ``browser:view`` and ``browser:page`` directives

2012-07-07 Thread Yvo Schubbe
Log message for revision 127279:
  - refactored ``browser:view`` and ``browser:page`` directives

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  UU  Zope/trunk/src/Products/Five/browser/metaconfigure.py
  U   Zope/trunk/src/Products/Five/browser/tests/pages.txt
  U   Zope/trunk/src/Products/Five/browser/tests/test_zope3security.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2012-07-06 22:50:25 UTC (rev 127278)
+++ Zope/trunk/doc/CHANGES.rst  2012-07-07 09:41:15 UTC (rev 127279)
@@ -40,6 +40,10 @@
 Features Added
 ++
 
+- Five: Refactored ``browser:view`` and ``browser:page`` directives.
+  This makes their implementation more similar to that in ``zope.browserpage``
+  and adds allowed_interface support for the ``browser:view`` directive.
+
 - Optimized the `OFS.Traversable.getPhysicalPath` method to avoid excessive
   amounts of method calls.
 

Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-06 
22:50:25 UTC (rev 127278)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-07 
09:41:15 UTC (rev 127279)
@@ -33,9 +33,12 @@
 from zope.security.zcml import Permission
 
 import zope.browserpage.metaconfigure
-from zope.browserpage.metaconfigure import providesCallable
-from zope.browserpage.metaconfigure import _handle_menu
+from zope.browserpage.metaconfigure import _handle_allowed_attributes
+from zope.browserpage.metaconfigure import _handle_allowed_interface
 from zope.browserpage.metaconfigure import _handle_for
+from zope.browserpage.metaconfigure import _handle_menu
+from zope.browserpage.metaconfigure import _handle_permission
+from zope.browserpage.metaconfigure import providesCallable
 from zope.browserpage.metadirectives import IViewDirective
 
 from AccessControl.class_init import InitializeClass
@@ -52,14 +55,48 @@
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from Products.Five.metaclass import makeClass
 
+def _configure_z2security(_context, new_class, required):
+_context.action(
+discriminator=('five:protectClass', new_class),
+callable=protectClass,
+args=(new_class, required.pop(''))
+)
+for attr, permission in required.iteritems():
+_context.action(
+discriminator=('five:protectName', new_class, attr),
+callable=protectName,
+args=(new_class, attr, permission)
+)
+# Make everything else private
+private_attrs = [name for name in dir(new_class)
+ if (not name.startswith('_')) and
+(name not in required) and
+ismethod(getattr(new_class, name))]
+for attr in private_attrs:
+_context.action(
+discriminator=('five:protectName', new_class, attr),
+callable=protectName,
+args=(new_class, attr, CheckerPrivateId, False)
+)
+# Protect the class
+_context.action(
+discriminator=('five:initialize:class', new_class),
+callable=InitializeClass,
+args=(new_class,)
+)
 
+# page
+
 def page(_context, name, permission, for_=Interface,
  layer=IDefaultBrowserLayer, template=None, class_=None,
  allowed_interface=None, allowed_attributes=None,
  attribute='__call__', menu=None, title=None, 
  ):
 _handle_menu(_context, menu, title, [for_], name, permission, layer)
+required = {}
 
+permission = _handle_permission(_context, permission)
+
 if not (class_ or template):
 raise ConfigurationError(Must specify a class or template)
 
@@ -77,6 +114,7 @@
 if not os.path.isfile(template):
 raise ConfigurationError(No such file, template)
 
+# TODO: new __name__ attribute must be tested
 if class_:
 if attribute != '__call__':
 if not hasattr(class_, attribute):
@@ -122,14 +160,18 @@
 # template
 new_class = makeClassForTemplate(template, name=name)
 
-if allowed_attributes is None:
-allowed_attributes = []
-if allowed_interface is not None:
-for interface in allowed_interface:
-allowed_attributes.extend(interface.names(all=True))
+for n in ('', attribute):
+required[n] = permission
 
+_handle_allowed_interface(_context, allowed_interface, permission,
+  required)
+_handle_allowed_attributes(_context, allowed_attributes, permission,
+   required)
+
 _handle_for(_context, for_)
 
+_configure_z2security(_context, new_class, required)
+
 _context.action(
 discriminator = ('view', (for_, layer), name, IBrowserRequest),
 callable = handler,
@@ -137,40 +179,7 @@
 new_class, (for_, 

[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - synced code with zope.browserpage (this should just simplify the diff without changing any behavior)

2012-07-05 Thread Yvo Schubbe
Log message for revision 127274:
  - synced code with zope.browserpage (this should just simplify the diff 
without changing any behavior)
  - related cleanup

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-05 
15:50:19 UTC (rev 127273)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-05 
16:29:17 UTC (rev 127274)
@@ -20,16 +20,16 @@
 import os
 from inspect import ismethod
 
-from zope import component
+from zope.component import queryMultiAdapter
+from zope.component.interface import provideInterface
+from zope.component.zcml import handler
+from zope.configuration.exceptions import ConfigurationError
 from zope.interface import implements
 from zope.interface import Interface
-from zope.component.zcml import handler
-from zope.component.interface import provideInterface
-from zope.configuration.exceptions import ConfigurationError
 from zope.publisher.interfaces import NotFound
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.security.zcml import Permission
 
 import zope.browserpage.metaconfigure
@@ -56,18 +56,12 @@
 def page(_context, name, permission, for_,
  layer=IDefaultBrowserLayer, template=None, class_=None,
  allowed_interface=None, allowed_attributes=None,
- attribute='__call__', menu=None, title=None,
+ attribute='__call__', menu=None, title=None, 
  ):
-
 _handle_menu(_context, menu, title, [for_], name, permission)
 
 if not (class_ or template):
 raise ConfigurationError(Must specify a class or template)
-if allowed_attributes is None:
-allowed_attributes = []
-if allowed_interface is not None:
-for interface in allowed_interface:
-allowed_attributes.extend(interface.names(all=True))
 
 if attribute != '__call__':
 if template:
@@ -92,6 +86,7 @@
 cdict = getSecurityInfo(class_)
 cdict['__name__'] = name
 if template:
+# class and template
 new_class = makeClassForTemplate(template, bases=(class_, ),
  cdict=cdict, name=name)
 elif attribute != __call__:
@@ -120,13 +115,19 @@
 # some security declarations on it so we really shouldn't
 # modify the original.  So, instead we make a new class
 # with just one base class -- the original
-new_class = makeClass(class_.__name__, 
+new_class = makeClass(class_.__name__,
   (class_, BrowserView), cdict)
 
 else:
 # template
 new_class = makeClassForTemplate(template, name=name)
 
+if allowed_attributes is None:
+allowed_attributes = []
+if allowed_interface is not None:
+for interface in allowed_interface:
+allowed_attributes.extend(interface.names(all=True))
+
 _handle_for(_context, for_)
 
 _context.action(
@@ -135,6 +136,9 @@
 args = ('registerAdapter',
 new_class, (for_, layer), Interface, name, _context.info),
 )
+
+# Security
+
 _context.action(
 discriminator = ('five:protectClass', new_class),
 callable = protectClass,
@@ -166,6 +170,7 @@
 args = (new_class,)
 )
 
+
 class pages(zope.browserpage.metaconfigure.pages):
 
 def page(self, _context, name, attribute='__call__', template=None,
@@ -200,6 +205,7 @@
 pages = {}
 
 for pname, attribute, template in self.pages:
+
 if template:
 cdict[pname] = ViewPageTemplateFile(template)
 if attribute and attribute != name:
@@ -222,8 +228,7 @@
 
 if name in pages:
 return getattr(self, pages[name])
-view = component.queryMultiAdapter((self, request), name=name,
-   default=None)
+view = queryMultiAdapter((self, request), name=name)
 if view is not None:
 return view
 
@@ -236,8 +241,7 @@
 
 if name in pages:
 return getattr(self, pages[name])
-view = component.queryMultiAdapter((self, request), name=name,
-   default=None)
+view = queryMultiAdapter((self, request), name=name)
 if view is not None:
 return view
 
@@ -266,10 +270,10 @@
 cname = str(name)
 except:
 cname = GeneratedClass
-
+
 

[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - fixed compatibility with zope.browserpage 4.0.0

2012-07-05 Thread Yvo Schubbe
Log message for revision 127275:
  - fixed compatibility with zope.browserpage 4.0.0

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-05 
16:29:17 UTC (rev 127274)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-05 
16:36:24 UTC (rev 127275)
@@ -131,7 +131,7 @@
 _handle_for(_context, for_)
 
 _context.action(
-discriminator = ('view', for_, name, IBrowserRequest, layer),
+discriminator = ('view', (for_, layer), name, IBrowserRequest),
 callable = handler,
 args = ('registerAdapter',
 new_class, (for_, layer), Interface, name, _context.info),
@@ -196,7 +196,7 @@
 class view(zope.browserpage.metaconfigure.view):
 
 def __call__(self):
-(_context, name, for_, permission, layer, class_,
+(_context, name, (for_, layer), permission, class_,
  allowed_interface, allowed_attributes) = self.args
 
 required = {}
@@ -284,8 +284,7 @@
 )
 
 _context.action(
-discriminator = ('view', for_, name, IBrowserRequest, layer,
- self.provides),
+discriminator = ('view', (for_, layer), name, self.provides),
 callable = handler,
 args = ('registerAdapter',
 newclass, (for_, layer), self.provides, name,

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/metaconfigure.py - reverted Zope2 specific changes that look unintended

2012-07-05 Thread Yvo Schubbe
Log message for revision 127276:
  - reverted Zope2 specific changes that look unintended

Changed:
  U   Zope/trunk/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-05 
16:36:24 UTC (rev 127275)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2012-07-05 
16:41:12 UTC (rev 127276)
@@ -53,12 +53,12 @@
 from Products.Five.metaclass import makeClass
 
 
-def page(_context, name, permission, for_,
+def page(_context, name, permission, for_=Interface,
  layer=IDefaultBrowserLayer, template=None, class_=None,
  allowed_interface=None, allowed_attributes=None,
  attribute='__call__', menu=None, title=None, 
  ):
-_handle_menu(_context, menu, title, [for_], name, permission)
+_handle_menu(_context, menu, title, [for_], name, permission, layer)
 
 if not (class_ or template):
 raise ConfigurationError(Must specify a class or template)

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


[Zope-Checkins] SVN: Zope/trunk/src/ - updated imports

2012-06-08 Thread Yvo Schubbe
Log message for revision 126684:
  - updated imports

Changed:
  U   Zope/trunk/src/OFS/interfaces.py
  U   Zope/trunk/src/Products/Five/component/__init__.py
  U   Zope/trunk/src/Products/Five/component/component.txt
  U   Zope/trunk/src/Products/Five/component/configure.zcml
  U   Zope/trunk/src/Products/Five/component/interfaces.py
  U   Zope/trunk/src/Products/Five/component/makesite.txt

-=-
Modified: Zope/trunk/src/OFS/interfaces.py
===
--- Zope/trunk/src/OFS/interfaces.py2012-06-08 00:41:18 UTC (rev 126683)
+++ Zope/trunk/src/OFS/interfaces.py2012-06-08 09:28:39 UTC (rev 126684)
@@ -13,10 +13,10 @@
 OFS interfaces.
 
 
+from zope.component.interfaces import IPossibleSite
 from zope.container.interfaces import IContainer
 from zope.interface import Attribute
 from zope.interface import Interface
-from zope.location.interfaces import IPossibleSite
 from zope.location.interfaces import IRoot
 from zope.schema import Bool, BytesLine, Tuple
 
@@ -567,7 +567,7 @@
 
 
 def manage_exportObject(id='', download=None, toxml=None,
-RESPONSE=None,REQUEST=None):
+RESPONSE=None, REQUEST=None):
 Exports an object to a file and returns that file.
 
 def manage_importObject(file, REQUEST=None, set_owner=1):

Modified: Zope/trunk/src/Products/Five/component/__init__.py
===
--- Zope/trunk/src/Products/Five/component/__init__.py  2012-06-08 00:41:18 UTC 
(rev 126683)
+++ Zope/trunk/src/Products/Five/component/__init__.py  2012-06-08 09:28:39 UTC 
(rev 126684)
@@ -14,11 +14,12 @@
 Five local component look-up support
 
 
-import zope.interface
 import zope.component
 import zope.event
+import zope.interface
 from zope.component.interfaces import IComponentLookup
-from zope.location.interfaces import ISite, IPossibleSite
+from zope.component.interfaces import IPossibleSite
+from zope.component.interfaces import ISite
 from zope.traversing.interfaces import BeforeTraverseEvent
 
 import ExtensionClass

Modified: Zope/trunk/src/Products/Five/component/component.txt
===
--- Zope/trunk/src/Products/Five/component/component.txt2012-06-08 
00:41:18 UTC (rev 126683)
+++ Zope/trunk/src/Products/Five/component/component.txt2012-06-08 
09:28:39 UTC (rev 126684)
@@ -19,8 +19,8 @@
 Now we create a site object with a stub component registry:
 
from OFS.ObjectManager import ObjectManager
+   from zope.component.interfaces import ISite
from zope.interface import alsoProvides
-   from zope.location.interfaces import ISite
 
components = object()
site = ObjectManager()

Modified: Zope/trunk/src/Products/Five/component/configure.zcml
===
--- Zope/trunk/src/Products/Five/component/configure.zcml   2012-06-08 
00:41:18 UTC (rev 126683)
+++ Zope/trunk/src/Products/Five/component/configure.zcml   2012-06-08 
09:28:39 UTC (rev 126684)
@@ -4,7 +4,7 @@
   adapter factory=.siteManagerAdapter /
 
   subscriber
-  for=zope.location.interfaces.ISite
+  for=zope.component.interfaces.ISite
zope.traversing.interfaces.IBeforeTraverseEvent
   handler=zope.site.site.threadSiteSubscriber
   /

Modified: Zope/trunk/src/Products/Five/component/interfaces.py
===
--- Zope/trunk/src/Products/Five/component/interfaces.py2012-06-08 
00:41:18 UTC (rev 126683)
+++ Zope/trunk/src/Products/Five/component/interfaces.py2012-06-08 
09:28:39 UTC (rev 126684)
@@ -14,8 +14,10 @@
 Component interfaces
 
 
-from zope.location.interfaces import ISite
+from zope.component.interfaces import ISite
 from OFS.interfaces import IObjectManager
 
+
 class IObjectManagerSite(IObjectManager, ISite):
+
 Object manager that is also a site.

Modified: Zope/trunk/src/Products/Five/component/makesite.txt
===
--- Zope/trunk/src/Products/Five/component/makesite.txt 2012-06-08 00:41:18 UTC 
(rev 126683)
+++ Zope/trunk/src/Products/Five/component/makesite.txt 2012-06-08 09:28:39 UTC 
(rev 126684)
@@ -48,7 +48,7 @@
 
 Now we ensure that the folder has been turned into a site:
 
- from zope.location.interfaces import ISite
+ from zope.component.interfaces import ISite
  ISite.providedBy(app.folder)
 True
 

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


[Zope-Checkins] SVN: Zope/branches/2.13/sources.cfg - keep sources in sync with versions

2012-04-27 Thread Yvo Schubbe
Log message for revision 125315:
  - keep sources in sync with versions

Changed:
  U   Zope/branches/2.13/sources.cfg

-=-
Modified: Zope/branches/2.13/sources.cfg
===
--- Zope/branches/2.13/sources.cfg  2012-04-26 22:27:29 UTC (rev 125314)
+++ Zope/branches/2.13/sources.cfg  2012-04-27 07:00:51 UTC (rev 125315)
@@ -15,7 +15,7 @@
 Products.OFSP = svn ^/Products.OFSP/trunk
 Products.PythonScripts = svn ^/Products.PythonScripts/trunk
 Products.StandardCacheManagers = svn ^/Products.StandardCacheManagers/trunk
-Products.ZCatalog = svn ^/Products.ZCatalog/trunk
+Products.ZCatalog = svn ^/Products.ZCatalog/branches/2.13
 Products.ZCTextIndex = svn ^/Products.ZCTextIndex/trunk
 Record = svn ^/Record/trunk
 tempstorage = svn ^/tempstorage/trunk

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


[Zope-Checkins] SVN: Zope/trunk/src/ - updated imports

2012-04-02 Thread Yvo Schubbe
Log message for revision 124871:
  - updated imports

Changed:
  UU  Zope/trunk/src/Products/Five/component/__init__.py
  UU  Zope/trunk/src/Products/Five/component/browser.py
  U   Zope/trunk/src/Products/Five/component/makesite.txt
  UU  Zope/trunk/src/Testing/ZopeTestCase/functional.py

-=-
Modified: Zope/trunk/src/Products/Five/component/__init__.py
===
--- Zope/trunk/src/Products/Five/component/__init__.py  2012-04-02 06:20:12 UTC 
(rev 124870)
+++ Zope/trunk/src/Products/Five/component/__init__.py  2012-04-02 06:30:34 UTC 
(rev 124871)
@@ -28,7 +28,7 @@
 from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
 
 # Hook up custom component architecture calls
-from zope.site.hooks import setHooks
+from zope.component.hooks import setHooks
 setHooks()
 
 def findSite(obj, iface=ISite):


Property changes on: Zope/trunk/src/Products/Five/component/__init__.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/Products/Five/component/browser.py
===
--- Zope/trunk/src/Products/Five/component/browser.py   2012-04-02 06:20:12 UTC 
(rev 124870)
+++ Zope/trunk/src/Products/Five/component/browser.py   2012-04-02 06:30:34 UTC 
(rev 124871)
@@ -19,8 +19,8 @@
 from Products.Five.component.interfaces import IObjectManagerSite
 
 from zope.component.globalregistry import base
+from zope.component.hooks import setSite
 from zope.component.persistentregistry import PersistentComponents
-from zope.site.hooks import setSite
 
 
 class ObjectManagerSiteView(BrowserView):


Property changes on: Zope/trunk/src/Products/Five/component/browser.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/Products/Five/component/makesite.txt
===
--- Zope/trunk/src/Products/Five/component/makesite.txt 2012-04-02 06:20:12 UTC 
(rev 124870)
+++ Zope/trunk/src/Products/Five/component/makesite.txt 2012-04-02 06:30:34 UTC 
(rev 124871)
@@ -18,7 +18,7 @@
 
 Enable local component lookup hooks:
 
- from zope.site.hooks import setHooks
+ from zope.component.hooks import setHooks
  setHooks()
 
 

Modified: Zope/trunk/src/Testing/ZopeTestCase/functional.py
===
--- Zope/trunk/src/Testing/ZopeTestCase/functional.py   2012-04-02 06:20:12 UTC 
(rev 124870)
+++ Zope/trunk/src/Testing/ZopeTestCase/functional.py   2012-04-02 06:30:34 UTC 
(rev 124871)
@@ -29,8 +29,8 @@
 '''
 from AccessControl.SecurityManagement import getSecurityManager
 from AccessControl.SecurityManagement import setSecurityManager
-from zope.site.hooks import getSite
-from zope.site.hooks import setSite
+from zope.component.hooks import getSite
+from zope.component.hooks import setSite
 
 def wrapped_func(*args, **kw):
 sm, site = getSecurityManager(), getSite()


Property changes on: Zope/trunk/src/Testing/ZopeTestCase/functional.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/branches/2.13/ - fixed a traversal regression

2012-02-23 Thread Yvo Schubbe
Log message for revision 124461:
  - fixed a traversal regression

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/ZPublisher/BaseRequest.py
  UU  Zope/branches/2.13/src/ZPublisher/tests/testBaseRequest.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2012-02-22 16:39:38 UTC (rev 124460)
+++ Zope/branches/2.13/doc/CHANGES.rst  2012-02-23 08:36:31 UTC (rev 124461)
@@ -8,8 +8,8 @@
 2.13.14 (unreleased)
 
 
+- ZPublisher: Fixed a traversal regression introduced in 2.13.12.
 
-
 2.13.13 (2012-02-20)
 
 

Modified: Zope/branches/2.13/src/ZPublisher/BaseRequest.py
===
--- Zope/branches/2.13/src/ZPublisher/BaseRequest.py2012-02-22 16:39:38 UTC 
(rev 124460)
+++ Zope/branches/2.13/src/ZPublisher/BaseRequest.py2012-02-23 08:36:31 UTC 
(rev 124461)
@@ -540,7 +540,7 @@
 if (no_acquire_flag and
 hasattr(parents[1], 'aq_base') and
 not hasattr(parents[1],'__bobo_traverse__')):
-base = parents[-1].aq_base
+base = parents[1].aq_base
 if not (hasattr(base, entry_name) or entry_name in base):
 raise AttributeError(entry_name)
 


Property changes on: Zope/branches/2.13/src/ZPublisher/BaseRequest.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/branches/2.13/src/ZPublisher/tests/testBaseRequest.py
===
--- Zope/branches/2.13/src/ZPublisher/tests/testBaseRequest.py  2012-02-22 
16:39:38 UTC (rev 124460)
+++ Zope/branches/2.13/src/ZPublisher/tests/testBaseRequest.py  2012-02-23 
08:36:31 UTC (rev 124461)
@@ -73,6 +73,9 @@
 # Attribute without docstring.
 return 'unpublishable'
 
+def __contains__(self, name):
+return False
+
 return DummyObjectBasic
 
 def _makeBasicObject(self):
@@ -194,6 +197,15 @@
 self.assertEqual(r.URL, '/folder/objBasic')
 self.assertEqual(r.response.base, '')
 
+def test_traverse_basic_no_acquire_flag(self):
+root, folder = self._makeRootAndFolder()
+folder._setObject('objBasic', self._makeBasicObject())
+r = self._makeOne(root)
+r['REQUEST_METHOD'] = 'HEAD'
+r.traverse('folder/objBasic')
+self.assertEqual(r.URL, '/folder/objBasic')
+self.assertEqual(r.response.base, '')
+
 def test_traverse_withDefault(self):
 root, folder = self._makeRootAndFolder()
 folder._setObject('objWithDefault', self._makeObjectWithDefault())


Property changes on: Zope/branches/2.13/src/ZPublisher/tests/testBaseRequest.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/ - fixed a traversal regression

2012-02-23 Thread Yvo Schubbe
Log message for revision 124462:
  - fixed a traversal regression

Changed:
  UU  Zope/trunk/src/ZPublisher/BaseRequest.py
  UU  Zope/trunk/src/ZPublisher/tests/testBaseRequest.py

-=-
Modified: Zope/trunk/src/ZPublisher/BaseRequest.py
===
--- Zope/trunk/src/ZPublisher/BaseRequest.py2012-02-23 08:36:31 UTC (rev 
124461)
+++ Zope/trunk/src/ZPublisher/BaseRequest.py2012-02-23 08:36:51 UTC (rev 
124462)
@@ -540,7 +540,7 @@
 if (no_acquire_flag and
 hasattr(parents[1], 'aq_base') and
 not hasattr(parents[1],'__bobo_traverse__')):
-base = parents[-1].aq_base
+base = parents[1].aq_base
 if not (hasattr(base, entry_name) or entry_name in base):
 raise AttributeError(entry_name)
 


Property changes on: Zope/trunk/src/ZPublisher/BaseRequest.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/ZPublisher/tests/testBaseRequest.py
===
--- Zope/trunk/src/ZPublisher/tests/testBaseRequest.py  2012-02-23 08:36:31 UTC 
(rev 124461)
+++ Zope/trunk/src/ZPublisher/tests/testBaseRequest.py  2012-02-23 08:36:51 UTC 
(rev 124462)
@@ -73,6 +73,9 @@
 # Attribute without docstring.
 return 'unpublishable'
 
+def __contains__(self, name):
+return False
+
 return DummyObjectBasic
 
 def _makeBasicObject(self):
@@ -194,6 +197,15 @@
 self.assertEqual(r.URL, '/folder/objBasic')
 self.assertEqual(r.response.base, '')
 
+def test_traverse_basic_no_acquire_flag(self):
+root, folder = self._makeRootAndFolder()
+folder._setObject('objBasic', self._makeBasicObject())
+r = self._makeOne(root)
+r['REQUEST_METHOD'] = 'HEAD'
+r.traverse('folder/objBasic')
+self.assertEqual(r.URL, '/folder/objBasic')
+self.assertEqual(r.response.base, '')
+
 def test_traverse_withDefault(self):
 root, folder = self._makeRootAndFolder()
 folder._setObject('objWithDefault', self._makeObjectWithDefault())


Property changes on: Zope/trunk/src/ZPublisher/tests/testBaseRequest.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/branches/2.13/ - LP #933307: Fixed ++skin++ namespace handling.

2012-02-16 Thread Yvo Schubbe
Log message for revision 124415:
  - LP #933307: Fixed ++skin++ namespace handling.

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/Products/Five/browser/tests/pages.py
  U   Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt
  U   Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml
  UU  Zope/branches/2.13/src/ZPublisher/HTTPRequest.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/doc/CHANGES.rst  2012-02-16 10:32:44 UTC (rev 124415)
@@ -8,6 +8,10 @@
 2.13.13 (unreleased)
 
 
+- LP #933307: Fixed ++skin++ namespace handling.
+  Ported the ``shiftNameToApplication`` implementation from zope.publisher to
+  ZPublisher.HTTPRequest.HTTPRequest.
+
 - Ensure that ObjectManager's ``get`` and ``__getitem__`` methods return only
   items (no attributes / methods from the class or from acquisition).
   Thanks to Richard Mitchell at Netsight for the report.

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/pages.py
===
--- Zope/branches/2.13/src/Products/Five/browser/tests/pages.py 2012-02-15 
18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/pages.py 2012-02-16 
10:32:44 UTC (rev 124415)
@@ -18,45 +18,59 @@
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from OFS.SimpleItem import SimpleItem
 
+
 class SimpleView(BrowserView):
+
 More docstring. Please Zope
 
 def eagle(self):
 Docstring
 return uThe eagle has landed
 
+def eagle2(self):
+Docstring
+return uThe eagle has landed:\n%s % self.context.absolute_url()
+
 def mouse(self):
 Docstring
 return uThe mouse has been eaten by the eagle
 
+
 class FancyView(BrowserView):
+
 Fancy, fancy stuff
 
 def view(self):
 return uFancy, fancy
 
+
 class CallView(BrowserView):
 
 def __call__(self):
 return uI was __call__()'ed
 
+
 class PermissionView(BrowserView, SimpleItem):
-
+
 def __call__(self):
 return uI was __call__()'ed
 
+
 class CallTemplate(BrowserView):
 
 __call__ = ViewPageTemplateFile('falcon.pt')
 
+
 class CallableNoDocstring:
 
 def __call__(self):
 return uNo docstring
 
+
 def function_no_docstring(self):
 return uNo docstring
 
+
 class NoDocstringView(BrowserView):
 
 def method(self):
@@ -66,7 +80,9 @@
 
 object = CallableNoDocstring()
 
+
 class NewStyleClass(object):
+
 
 This is a testclass to verify that new style classes work
 in browser:page


Property changes on: Zope/branches/2.13/src/Products/Five/browser/tests/pages.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt
===
--- Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt 2012-02-15 
18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt 2012-02-16 
10:32:44 UTC (rev 124415)
@@ -25,11 +25,12 @@
 It works when we explicitly use the skin that includes that layer:
 
print http(r
-  ... GET /test_folder_1_/testoid/++skin++TestSkin/eagle.html HTTP/1.1
+  ... GET /++skin++TestSkin/test_folder_1_/testoid/eagle.html HTTP/1.1
   ... )
   HTTP/1.1 200 OK
   ...
-  The eagle has landed
+  The eagle has landed:
+  http://localhost/++skin++TestSkin/test_folder_1_/testoid
 
 Or when we make that skin the default skin:
 
@@ -44,7 +45,8 @@
   ... )
   HTTP/1.1 200 OK
   ...
-  The eagle has landed
+  The eagle has landed:
+  http://localhost/test_folder_1_/testoid
 
 
 Clean up

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml
===
--- Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml
2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml
2012-02-16 10:32:44 UTC (rev 124415)
@@ -14,7 +14,7 @@
   browser:page
   for=Products.Five.tests.testing.simplecontent.ISimpleContent
   class=.pages.SimpleView
-  attribute=eagle
+  attribute=eagle2
   name=eagle.html
   permission=zope2.Public
   layer=.skin.ITestSkin

Modified: Zope/branches/2.13/src/ZPublisher/HTTPRequest.py
===
--- Zope/branches/2.13/src/ZPublisher/HTTPRequest.py2012-02-15 18:24:17 UTC 
(rev 124414)
+++ Zope/branches/2.13/src/ZPublisher/HTTPRequest.py2012-02-16 10:32:44 UTC 
(rev 124415)
@@ -1528,10 +1528,17 @@
 def taintWrapper(self, enabled=TAINTING_ENABLED):
 return enabled and TaintRequestWrapper(self) or self
 
+# Original 

[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/HTTPRequest.py - LP #933307: Fixed ++skin++ namespace handling.

2012-02-16 Thread Yvo Schubbe
Log message for revision 124416:
  - LP #933307: Fixed ++skin++ namespace handling.

Changed:
  U   Zope/trunk/src/ZPublisher/HTTPRequest.py

-=-
Modified: Zope/trunk/src/ZPublisher/HTTPRequest.py
===
--- Zope/trunk/src/ZPublisher/HTTPRequest.py2012-02-16 10:32:44 UTC (rev 
124415)
+++ Zope/trunk/src/ZPublisher/HTTPRequest.py2012-02-16 10:33:21 UTC (rev 
124416)
@@ -1532,10 +1532,17 @@
 def taintWrapper(self, enabled=TAINTING_ENABLED):
 return enabled and TaintRequestWrapper(self) or self
 
+# Original version: zope.publisher.http.HTTPRequest.shiftNameToApplication
 def shiftNameToApplication(self):
 see zope.publisher.interfaces.http.IVirtualHostRequest
-# this is needed for ++skin++
+if len(self._steps) == 1:
+self._script.append(self._steps.pop())
+self._resetURLS()
+return
 
+raise ValueError(Can only shift leading traversal 
+ names to application names)
+
 def getURL(self):
 return self.URL
 

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


[Zope-Checkins] SVN: Zope/trunk/ - reverted r122056 and merged test improvements from 2.13 branch

2012-02-16 Thread Yvo Schubbe
Log message for revision 124417:
  - reverted r122056 and merged test improvements from 2.13 branch
  (see https://mail.zope.org/pipermail/zope-dev/2011-November/043733.html)

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  UU  Zope/trunk/src/Products/Five/browser/tests/pages.py
  A   Zope/trunk/src/Products/Five/browser/tests/skin.py
  A   Zope/trunk/src/Products/Five/browser/tests/skin.txt
  A   Zope/trunk/src/Products/Five/browser/tests/skin.zcml
  A   Zope/trunk/src/Products/Five/browser/tests/test_skin.py
  U   Zope/trunk/src/Zope2/App/traversing.zcml

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2012-02-16 10:33:21 UTC (rev 124416)
+++ Zope/trunk/doc/CHANGES.rst  2012-02-16 10:57:43 UTC (rev 124417)
@@ -136,15 +136,6 @@
   `lib/python` and `Products` from the default. You can continue to manually
   add these back.
 
-- Removed the rarely used support for the `++skin++` traverser. You can enable
-  it in your own applications by defining::
-
-adapter
-  name=skin
-  for=* zope.publisher.interfaces.IRequest
-  provides=zope.traversing.interfaces.ITraversable
-  factory=zope.traversing.namespace.skin /
-
 - Five.browser: Marked `processInputs` and `setPageEncoding` as deprecated.
   `processInputs` was replaced by the `postProcessInputs` request method and
   the charset negotiation done by `setPageEncoding` was never fully supported.

Modified: Zope/trunk/src/Products/Five/browser/tests/pages.py
===
--- Zope/trunk/src/Products/Five/browser/tests/pages.py 2012-02-16 10:33:21 UTC 
(rev 124416)
+++ Zope/trunk/src/Products/Five/browser/tests/pages.py 2012-02-16 10:57:43 UTC 
(rev 124417)
@@ -18,45 +18,59 @@
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from OFS.SimpleItem import SimpleItem
 
+
 class SimpleView(BrowserView):
+
 More docstring. Please Zope
 
 def eagle(self):
 Docstring
 return uThe eagle has landed
 
+def eagle2(self):
+Docstring
+return uThe eagle has landed:\n%s % self.context.absolute_url()
+
 def mouse(self):
 Docstring
 return uThe mouse has been eaten by the eagle
 
+
 class FancyView(BrowserView):
+
 Fancy, fancy stuff
 
 def view(self):
 return uFancy, fancy
 
+
 class CallView(BrowserView):
 
 def __call__(self):
 return uI was __call__()'ed
 
+
 class PermissionView(BrowserView, SimpleItem):
-
+
 def __call__(self):
 return uI was __call__()'ed
 
+
 class CallTemplate(BrowserView):
 
 __call__ = ViewPageTemplateFile('falcon.pt')
 
+
 class CallableNoDocstring:
 
 def __call__(self):
 return uNo docstring
 
+
 def function_no_docstring(self):
 return uNo docstring
 
+
 class NoDocstringView(BrowserView):
 
 def method(self):
@@ -66,7 +80,9 @@
 
 object = CallableNoDocstring()
 
+
 class NewStyleClass(object):
+
 
 This is a testclass to verify that new style classes work
 in browser:page


Property changes on: Zope/trunk/src/Products/Five/browser/tests/pages.py
___
Deleted: svn:keywords
   - Id

Copied: Zope/trunk/src/Products/Five/browser/tests/skin.py (from rev 124416, 
Zope/branches/2.13/src/Products/Five/browser/tests/skin.py)
===
--- Zope/trunk/src/Products/Five/browser/tests/skin.py  
(rev 0)
+++ Zope/trunk/src/Products/Five/browser/tests/skin.py  2012-02-16 10:57:43 UTC 
(rev 124417)
@@ -0,0 +1,20 @@
+##
+#
+# Copyright (c) 2006 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.
+#
+##
+Test skins
+
+
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+
+class ITestSkin(IDefaultBrowserLayer):
+pass


Property changes on: Zope/trunk/src/Products/Five/browser/tests/skin.py
___
Added: svn:eol-style
   + native

Copied: Zope/trunk/src/Products/Five/browser/tests/skin.txt (from rev 124416, 
Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt)
===
--- Zope/trunk/src/Products/Five/browser/tests/skin.txt 
(rev 0)
+++ 

[Zope-Checkins] SVN: Zope/branches/z4-zmi/ - deleted obsolete branch

2012-02-16 Thread Yvo Schubbe
Log message for revision 124419:
  - deleted obsolete branch

Changed:
  D   Zope/branches/z4-zmi/

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/ - fixed ZPL version

2012-02-05 Thread Yvo Schubbe
Log message for revision 124309:
  - fixed ZPL version

Changed:
  U   Zope/branches/2.12/src/OFS/tests/test_Uninstalled.py
  U   Zope/branches/2.12/src/ZPublisher/HTTPResponse.py
  U   Zope/branches/2.12/src/ZPublisher/tests/test_Converters.py

-=-
Modified: Zope/branches/2.12/src/OFS/tests/test_Uninstalled.py
===
--- Zope/branches/2.12/src/OFS/tests/test_Uninstalled.py2012-02-05 
21:10:36 UTC (rev 124308)
+++ Zope/branches/2.12/src/OFS/tests/test_Uninstalled.py2012-02-06 
07:08:01 UTC (rev 124309)
@@ -1,10 +1,9 @@
 ##
 #
 # Copyright (c) 2006 Zope Foundation and Contributors.
-# All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# 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

Modified: Zope/branches/2.12/src/ZPublisher/HTTPResponse.py
===
--- Zope/branches/2.12/src/ZPublisher/HTTPResponse.py   2012-02-05 21:10:36 UTC 
(rev 124308)
+++ Zope/branches/2.12/src/ZPublisher/HTTPResponse.py   2012-02-06 07:08:01 UTC 
(rev 124309)
@@ -1,13 +1,13 @@
-#
+##
 #
 # Copyright (c) 2001 Zope Foundation and Contributors.
 #
 # This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 '''CGI Response Output formatter

Modified: Zope/branches/2.12/src/ZPublisher/tests/test_Converters.py
===
--- Zope/branches/2.12/src/ZPublisher/tests/test_Converters.py  2012-02-05 
21:10:36 UTC (rev 124308)
+++ Zope/branches/2.12/src/ZPublisher/tests/test_Converters.py  2012-02-06 
07:08:01 UTC (rev 124309)
@@ -1,15 +1,15 @@
-
+##
 #
 # Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# 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
+# FOR A PARTICULAR PURPOSE.
 #
-
+##
 
 import unittest
 

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/ explicit is better than implicit

2011-11-14 Thread Yvo Schubbe
Log message for revision 123341:
  explicit is better than implicit

Changed:
  U   Zope/branches/2.12/src/OFS/Image.py
  U   Zope/branches/2.12/src/webdav/LockItem.py

-=-
Modified: Zope/branches/2.12/src/OFS/Image.py
===
--- Zope/branches/2.12/src/OFS/Image.py 2011-11-14 16:41:37 UTC (rev 123340)
+++ Zope/branches/2.12/src/OFS/Image.py 2011-11-14 16:42:11 UTC (rev 123341)
@@ -36,7 +36,6 @@
 from webdav.Lockable import ResourceLockedError
 from ZPublisher import HTTPRangeSupport
 from ZPublisher.HTTPRequest import FileUpload
-from ZPublisher.Iterators import filestream_iterator
 from zExceptions import Redirect
 from zope.contenttype import guess_content_type
 from zope.interface import implementedBy
@@ -657,6 +656,9 @@
 
 return ''
 
+InitializeClass(File)
+
+
 manage_addImageForm=DTMLFile('dtml/imageAdd',globals(),
  Kind='Image',kind='image')
 def manage_addImage(self, id, file, title='', precondition='', content_type='',
@@ -898,7 +900,9 @@
 
 return '%s /' % result
 
+InitializeClass(Image)
 
+
 def cookId(id, title, file):
 if not id and hasattr(file,'filename'):
 filename=file.filename

Modified: Zope/branches/2.12/src/webdav/LockItem.py
===
--- Zope/branches/2.12/src/webdav/LockItem.py   2011-11-14 16:41:37 UTC (rev 
123340)
+++ Zope/branches/2.12/src/webdav/LockItem.py   2011-11-14 16:42:11 UTC (rev 
123341)
@@ -19,6 +19,7 @@
 
 from AccessControl.Owned import ownerInfo
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import InitializeClass
 from Persistence import Persistent
 from zope.interface import implements
 
@@ -173,7 +174,6 @@
 return s
 
 def asXML(self):
-
 s = ?xml version=1.0 encoding=utf-8 ?
 d:prop xmlns:d=DAV:
  d:lockdiscovery
@@ -181,3 +181,5 @@
  /d:lockdiscovery
 /d:prop % self.asLockDiscoveryProperty(ns=d)
 return s
+
+InitializeClass(LockItem)

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


[Zope-Checkins] SVN: Zope/trunk/src/ explicit is better than implicit

2011-11-14 Thread Yvo Schubbe
Log message for revision 123343:
  explicit is better than implicit

Changed:
  U   Zope/trunk/src/OFS/Image.py
  U   Zope/trunk/src/webdav/LockItem.py

-=-
Modified: Zope/trunk/src/OFS/Image.py
===
--- Zope/trunk/src/OFS/Image.py 2011-11-14 16:42:24 UTC (rev 123342)
+++ Zope/trunk/src/OFS/Image.py 2011-11-14 16:42:41 UTC (rev 123343)
@@ -34,7 +34,6 @@
 from webdav.Lockable import ResourceLockedError
 from ZPublisher import HTTPRangeSupport
 from ZPublisher.HTTPRequest import FileUpload
-from ZPublisher.Iterators import filestream_iterator
 from zExceptions import Redirect
 from zope.contenttype import guess_content_type
 from zope.interface import implementedBy
@@ -651,6 +650,9 @@
 
 return ''
 
+InitializeClass(File)
+
+
 manage_addImageForm=DTMLFile('dtml/imageAdd',globals(),
  Kind='Image',kind='image')
 def manage_addImage(self, id, file, title='', precondition='', content_type='',
@@ -890,7 +892,9 @@
 
 return '%s /' % result
 
+InitializeClass(Image)
 
+
 def cookId(id, title, file):
 if not id and hasattr(file,'filename'):
 filename=file.filename

Modified: Zope/trunk/src/webdav/LockItem.py
===
--- Zope/trunk/src/webdav/LockItem.py   2011-11-14 16:42:24 UTC (rev 123342)
+++ Zope/trunk/src/webdav/LockItem.py   2011-11-14 16:42:41 UTC (rev 123343)
@@ -15,6 +15,7 @@
 
 import time
 
+from AccessControl.class_init import InitializeClass
 from AccessControl.owner import ownerInfo
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Persistence import Persistent
@@ -171,7 +172,6 @@
 return s
 
 def asXML(self):
-
 s = ?xml version=1.0 encoding=utf-8 ?
 d:prop xmlns:d=DAV:
  d:lockdiscovery
@@ -179,3 +179,5 @@
  /d:lockdiscovery
 /d:prop % self.asLockDiscoveryProperty(ns=d)
 return s
+
+InitializeClass(LockItem)

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


[Zope-Checkins] SVN: Zope/trunk/ - made version number compatible with version_txt.py

2011-07-11 Thread Yvo Schubbe
Log message for revision 122139:
  - made version number compatible with version_txt.py

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/setup.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2011-07-09 09:10:06 UTC (rev 122138)
+++ Zope/trunk/doc/CHANGES.rst  2011-07-11 11:07:33 UTC (rev 122139)
@@ -5,8 +5,8 @@
 Change information for previous versions of Zope can be found at
 http://docs.zope.org/zope2/releases/.
 
-4.0a1 (unreleased)
---
+4.0.0a1 (unreleased)
+
 
 Bugs Fixed
 ++

Modified: Zope/trunk/setup.py
===
--- Zope/trunk/setup.py 2011-07-09 09:10:06 UTC (rev 122138)
+++ Zope/trunk/setup.py 2011-07-11 11:07:33 UTC (rev 122139)
@@ -23,7 +23,7 @@
 
 
 setup(name='Zope2',
-version='4.0a1.dev',
+version='4.0.0a1.dev',
 url='http://zope2.zope.org',
 license='ZPL 2.1',
 description='Zope2 application server / web framework',

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


[Zope-Checkins] SVN: Zope/branches/2.13/ - re-added 'extra' argument (someone was missing it)

2011-06-08 Thread Yvo Schubbe
Log message for revision 121895:
  - re-added 'extra' argument (someone was missing it)

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  U   Zope/branches/2.13/src/Testing/ZopeTestCase/functional.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2011-06-08 14:59:27 UTC (rev 121894)
+++ Zope/branches/2.13/doc/CHANGES.rst  2011-06-08 15:29:04 UTC (rev 121895)
@@ -11,6 +11,9 @@
 Bugs Fixed
 ++
 
+- Testing: Re-added 'extra' argument to Functional.publish.
+  Removing it in Zope 2.13.0a1 did break backwards compatibility.
+
 - LP #787541: Fix WSGIPublisher to close requests on abort unconditionally.
   Previously an addAfterCommitHook was used, but this is not run on transaction
   aborts.  Now a Synchronizer is used which unconditionally closes the request

Modified: Zope/branches/2.13/src/Testing/ZopeTestCase/functional.py
===
--- Zope/branches/2.13/src/Testing/ZopeTestCase/functional.py   2011-06-08 
14:59:27 UTC (rev 121894)
+++ Zope/branches/2.13/src/Testing/ZopeTestCase/functional.py   2011-06-08 
15:29:04 UTC (rev 121895)
@@ -53,11 +53,12 @@
 implements(interfaces.IFunctional)
 
 @savestate
-def publish(self, path, basic=None, env=None, request_method='GET',
-stdin=None, handle_errors=True):
+def publish(self, path, basic=None, env=None, extra=None,
+request_method='GET', stdin=None, handle_errors=True):
 '''Publishes the object at 'path' returning a response object.'''
 
 from StringIO import StringIO
+from ZPublisher.Request import Request
 from ZPublisher.Response import Response
 from ZPublisher.Publish import publish_module
 
@@ -66,6 +67,8 @@
 
 if env is None:
 env = {}
+if extra is None:
+extra = {}
 
 request = self.app.REQUEST
 
@@ -89,12 +92,14 @@
 
 outstream = StringIO()
 response = Response(stdout=outstream, stderr=sys.stderr)
+request = Request(stdin, env, response)
+for k, v in extra.items():
+request[k] = v
 
 publish_module('Zope2',
+   debug=not handle_errors,
+   request=request,
response=response,
-   stdin=stdin,
-   environ=env,
-   debug=not handle_errors,
   )
 
 return ResponseWrapper(response, outstream, path)

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


[Zope-Checkins] SVN: Zope/trunk/src/Testing/ZopeTestCase/functional.py - re-added 'extra' argument (someone was missing it)

2011-06-08 Thread Yvo Schubbe
Log message for revision 121896:
  - re-added 'extra' argument (someone was missing it)

Changed:
  U   Zope/trunk/src/Testing/ZopeTestCase/functional.py

-=-
Modified: Zope/trunk/src/Testing/ZopeTestCase/functional.py
===
--- Zope/trunk/src/Testing/ZopeTestCase/functional.py   2011-06-08 15:29:04 UTC 
(rev 121895)
+++ Zope/trunk/src/Testing/ZopeTestCase/functional.py   2011-06-08 15:30:01 UTC 
(rev 121896)
@@ -53,11 +53,12 @@
 implements(interfaces.IFunctional)
 
 @savestate
-def publish(self, path, basic=None, env=None, request_method='GET',
-stdin=None, handle_errors=True):
+def publish(self, path, basic=None, env=None, extra=None,
+request_method='GET', stdin=None, handle_errors=True):
 '''Publishes the object at 'path' returning a response object.'''
 
 from StringIO import StringIO
+from ZPublisher.Request import Request
 from ZPublisher.Response import Response
 from ZPublisher.Publish import publish_module
 
@@ -66,6 +67,8 @@
 
 if env is None:
 env = {}
+if extra is None:
+extra = {}
 
 request = self.app.REQUEST
 
@@ -89,12 +92,14 @@
 
 outstream = StringIO()
 response = Response(stdout=outstream, stderr=sys.stderr)
+request = Request(stdin, env, response)
+for k, v in extra.items():
+request[k] = v
 
 publish_module('Zope2',
+   debug=not handle_errors,
+   request=request,
response=response,
-   stdin=stdin,
-   environ=env,
-   debug=not handle_errors,
   )
 
 return ResponseWrapper(response, outstream, path)

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


[Zope-Checkins] SVN: Zope/trunk/sources.cfg - synced sources.cfg with versions.cfg, using the new ztk-sources.cfg

2011-05-19 Thread Yvo Schubbe
Log message for revision 121749:
  - synced sources.cfg with versions.cfg, using the new ztk-sources.cfg

Changed:
  U   Zope/trunk/sources.cfg

-=-
Modified: Zope/trunk/sources.cfg
===
--- Zope/trunk/sources.cfg  2011-05-19 14:33:46 UTC (rev 121748)
+++ Zope/trunk/sources.cfg  2011-05-19 14:36:58 UTC (rev 121749)
@@ -1,4 +1,8 @@
+[buildout]
+extends = http://svn.zope.org/repos/main/zopetoolkit/trunk/ztk-sources.cfg
+
 [sources]
+# Zope2-specific
 AccessControl = svn ^/AccessControl/trunk
 Acquisition = svn ^/Acquisition/trunk
 DateTime = svn ^/DateTime/trunk
@@ -15,6 +19,12 @@
 Record = svn ^/Record/trunk
 tempstorage = svn ^/tempstorage/trunk
 zExceptions = svn ^/zExceptions/trunk
-ZODB3 = svn ^/ZODB/trunk
+zLOG = svn ^/zLOG/trunk
 ZopeUndo = svn ^/ZopeUndo/trunk
-ZConfig = svn ^/ZConfig/trunk
+
+# Deprecated / CMF dependencies
+Products.BTreeFolder2 = svn ^/Products.BTreeFolder2/trunk
+Products.ExternalMethod = svn ^/Products.ExternalMethod/trunk
+Products.MailHost = svn ^/Products.MailHost/trunk
+Products.PythonScripts = svn ^/Products.PythonScripts/trunk
+Products.StandardCacheManagers = svn ^/Products.StandardCacheManagers/trunk

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


[Zope-Checkins] SVN: Zope/trunk/sources.cfg - made it easier to reuse sources.cfg

2011-05-19 Thread Yvo Schubbe
Log message for revision 121751:
  - made it easier to reuse sources.cfg

Changed:
  U   Zope/trunk/sources.cfg

-=-
Modified: Zope/trunk/sources.cfg
===
--- Zope/trunk/sources.cfg  2011-05-19 14:42:40 UTC (rev 121750)
+++ Zope/trunk/sources.cfg  2011-05-19 14:50:39 UTC (rev 121751)
@@ -1,30 +1,31 @@
 [buildout]
 extends = http://svn.zope.org/repos/main/zopetoolkit/trunk/ztk-sources.cfg
+svn-zope-org = ^
 
 [sources]
 # Zope2-specific
-AccessControl = svn ^/AccessControl/trunk
-Acquisition = svn ^/Acquisition/trunk
-DateTime = svn ^/DateTime/trunk
-DocumentTemplate = svn ^/DocumentTemplate/trunk
-ExtensionClass = svn ^/ExtensionClass/trunk
-initgroups = svn ^/initgroups/trunk
-Missing = svn ^/Missing/trunk
-MultiMapping = svn ^/MultiMapping/trunk
-nt_svcutils = svn ^/nt_svcutils/trunk
-Persistence = svn ^/Persistence/trunk
-Products.OFSP = svn ^/Products.OFSP/trunk
-Products.ZCatalog = svn ^/Products.ZCatalog/trunk
-Products.ZCTextIndex = svn ^/Products.ZCTextIndex/trunk
-Record = svn ^/Record/trunk
-tempstorage = svn ^/tempstorage/trunk
-zExceptions = svn ^/zExceptions/trunk
-zLOG = svn ^/zLOG/trunk
-ZopeUndo = svn ^/ZopeUndo/trunk
+AccessControl = svn ${buildout:svn-zope-org}/AccessControl/trunk
+Acquisition = svn ${buildout:svn-zope-org}/Acquisition/trunk
+DateTime = svn ${buildout:svn-zope-org}/DateTime/trunk
+DocumentTemplate = svn ${buildout:svn-zope-org}/DocumentTemplate/trunk
+ExtensionClass = svn ${buildout:svn-zope-org}/ExtensionClass/trunk
+initgroups = svn ${buildout:svn-zope-org}/initgroups/trunk
+Missing = svn ${buildout:svn-zope-org}/Missing/trunk
+MultiMapping = svn ${buildout:svn-zope-org}/MultiMapping/trunk
+nt_svcutils = svn ${buildout:svn-zope-org}/nt_svcutils/trunk
+Persistence = svn ${buildout:svn-zope-org}/Persistence/trunk
+Products.OFSP = svn ${buildout:svn-zope-org}/Products.OFSP/trunk
+Products.ZCatalog = svn ${buildout:svn-zope-org}/Products.ZCatalog/trunk
+Products.ZCTextIndex = svn ${buildout:svn-zope-org}/Products.ZCTextIndex/trunk
+Record = svn ${buildout:svn-zope-org}/Record/trunk
+tempstorage = svn ${buildout:svn-zope-org}/tempstorage/trunk
+zExceptions = svn ${buildout:svn-zope-org}/zExceptions/trunk
+zLOG = svn ${buildout:svn-zope-org}/zLOG/trunk
+ZopeUndo = svn ${buildout:svn-zope-org}/ZopeUndo/trunk
 
 # Deprecated / CMF dependencies
-Products.BTreeFolder2 = svn ^/Products.BTreeFolder2/trunk
-Products.ExternalMethod = svn ^/Products.ExternalMethod/trunk
-Products.MailHost = svn ^/Products.MailHost/trunk
-Products.PythonScripts = svn ^/Products.PythonScripts/trunk
-Products.StandardCacheManagers = svn ^/Products.StandardCacheManagers/trunk
+Products.BTreeFolder2 = svn 
${buildout:svn-zope-org}/Products.BTreeFolder2/trunk
+Products.ExternalMethod = svn 
${buildout:svn-zope-org}/Products.ExternalMethod/trunk
+Products.MailHost = svn ${buildout:svn-zope-org}/Products.MailHost/trunk
+Products.PythonScripts = svn 
${buildout:svn-zope-org}/Products.PythonScripts/trunk
+Products.StandardCacheManagers = svn 
${buildout:svn-zope-org}/Products.StandardCacheManagers/trunk

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


[Zope-Checkins] SVN: Zope/branches/2.13/src/OFS/dtml/properties.dtml - fixed some HTML issues

2011-03-10 Thread Yvo Schubbe
Log message for revision 120838:
  - fixed some HTML issues
  - related cleanup

Changed:
  UU  Zope/branches/2.13/src/OFS/dtml/properties.dtml

-=-
Modified: Zope/branches/2.13/src/OFS/dtml/properties.dtml
===
--- Zope/branches/2.13/src/OFS/dtml/properties.dtml 2011-03-10 08:49:03 UTC 
(rev 120837)
+++ Zope/branches/2.13/src/OFS/dtml/properties.dtml 2011-03-10 09:49:23 UTC 
(rev 120838)
@@ -56,69 +56,74 @@
 
 dtml-in propertyMap mapping
 dtml-let type=not _.has_key('type') and 'string' or type
-  pdesc=propertyDescription(id)
+  pdesc=propertyDescription(id)
+  charset_tag=REQUEST['management_page_charset_tag']
 tr title=dtml-pdesc;
   td align=left valign=top width=16
   dtml-if 'd' in _['sequence-item'].get('mode', 'awd')
-  input type=checkbox name=_ids:dtml-var 
REQUEST['management_page_charset_tag']string:list value=dtml-id;
-   id=cb-dtml-id;
+  input type=checkbox name=_ids:dtml-charset_tag;string:list
+   value=dtml-id; id=cb-dtml-id; /
   dtml-else
   /dtml-if
   /td
   td align=left valign=top
   div class=form-label
-  label for=cb-dtml-id;dtml-var propertyLabel(id) html_quote/label
+  dtml-if 'd' in _['sequence-item'].get('mode', 'awd')
+  label for=cb-dtml-id;
+  dtml-else
+  label
+  /dtml-if
+  dtml-var propertyLabel(id) html_quote/label
   /div
   /td
   td align=left valign=top
-
   dtml-if 'w' in _['sequence-item'].get('mode', 'awd')
   dtml-if type == 'int'
   input type=text name=dtml-id;:dtml-type;
-   size=35 value=dtml-if hasProperty(id)dtml-var '%s' % 
getProperty(id) html_quote/dtml-if
+   size=35 value=dtml-if hasProperty(id)dtml-var
+'%s' % getProperty(id) html_quote/dtml-if /
   dtml-elif type == 'long'
   input type=text name=dtml-id;:dtml-type; size=35
-   value=dtml-if hasProperty(id)dtml-var ('%s' % getProperty(id)) 
html_quote/dtml-if
+   value=dtml-if hasProperty(id)dtml-var
+('%s' % getProperty(id)) html_quote/dtml-if /
   dtml-elif type in ('float', 'date')
-  input type=text name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']dtml-type; size=35
-   value=dtml-var getProperty(id) html_quote
+  input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
+   value=dtml-var getProperty(id) html_quote /
   dtml-elif type in ['string','ustring']
-  input type=text name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']dtml-type; size=35
-   value=dtml-var getProperty(id) html_quote
+  input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
+   value=dtml-var getProperty(id) html_quote /
   dtml-elif type=='boolean'
-  input type=checkbox name=dtml-id;:boolean size=35
-   dtml-if getProperty(id)CHECKED/dtml-if
+  input type=checkbox name=dtml-id;:dtml-type; size=35
+   dtml-if getProperty(id)checked=checked/dtml-if /
   dtml-elif type in ['tokens','utokens']
-  input type=text name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']dtml-type; size=35
-   value=dtml-in getProperty(id)dtml-sequence-item; /dtml-in
+  input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
+   value=dtml-in getProperty(id)dtml-sequence-item; /dtml-in /
   dtml-elif type in ['text','utext']
-  textarea class=form-element name=dtml-id;:dtml-var
-   REQUEST['management_page_charset_tag']dtml-type;
+  textarea class=form-element name=dtml-id;:dtml-charset_tag;dtml-type;
rows=6 cols=35dtml-var getProperty(id) html_quote/textarea
   dtml-elif type in ['lines','ulines']
-  textarea class=form-element name=dtml-id;:dtml-var
-   REQUEST['management_page_charset_tag']dtml-type; rows=6
-   cols=35dtml-in getProperty(id)dtml-sequence-item;dtml-if
+  textarea class=form-element name=dtml-id;:dtml-charset_tag;dtml-type;
+   rows=6 cols=35dtml-in getProperty(id)dtml-sequence-item;dtml-if
sequence-enddtml-elsedtml-var '\n'/dtml-if/dtml-in/textarea
 
   dtml-elif type=='selection'
 
 dtml-if hasProperty(select_variable)
 div class=form-element
-select name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']text
+select name=dtml-id;:dtml-charset_tag;text
   dtml-in getProperty(select_variable)
  option
-  dtml-if _['sequence-item']==getProperty(id)SELECTED/dtml-if
+  dtml-if 
_['sequence-item']==getProperty(id)selected=selected/dtml-if
   dtml-sequence-item;/option
   /dtml-in
 /select
 /div
 dtml-elif _.has_key(select_variable)
 div class=form-element
-select name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']text
+select name=dtml-id;:dtml-charset_tag;text
   dtml-in _[select_variable]
  option
-  dtml-if _['sequence-item']==getProperty(id)SELECTED/dtml-if
+  dtml-if 
_['sequence-item']==getProperty(id)selected=selected/dtml-if
   dtml-sequence-item;/option
   /dtml-in
 /select
@@ -133,24 +138,24 @@
 
 dtml-if hasProperty(select_variable)
 div class=form-element
-select name=dtml-id;:dtml-var 

[Zope-Checkins] SVN: Zope/trunk/src/OFS/dtml/properties.dtml - fixed some HTML issues

2011-03-10 Thread Yvo Schubbe
Log message for revision 120839:
  - fixed some HTML issues
  - related cleanup

Changed:
  UU  Zope/trunk/src/OFS/dtml/properties.dtml

-=-
Modified: Zope/trunk/src/OFS/dtml/properties.dtml
===
--- Zope/trunk/src/OFS/dtml/properties.dtml 2011-03-10 09:49:23 UTC (rev 
120838)
+++ Zope/trunk/src/OFS/dtml/properties.dtml 2011-03-10 09:49:42 UTC (rev 
120839)
@@ -56,69 +56,74 @@
 
 dtml-in propertyMap mapping
 dtml-let type=not _.has_key('type') and 'string' or type
-  pdesc=propertyDescription(id)
+  pdesc=propertyDescription(id)
+  charset_tag=REQUEST['management_page_charset_tag']
 tr title=dtml-pdesc;
   td align=left valign=top width=16
   dtml-if 'd' in _['sequence-item'].get('mode', 'awd')
-  input type=checkbox name=_ids:dtml-var 
REQUEST['management_page_charset_tag']string:list value=dtml-id;
-   id=cb-dtml-id;
+  input type=checkbox name=_ids:dtml-charset_tag;string:list
+   value=dtml-id; id=cb-dtml-id; /
   dtml-else
   /dtml-if
   /td
   td align=left valign=top
   div class=form-label
-  label for=cb-dtml-id;dtml-var propertyLabel(id) html_quote/label
+  dtml-if 'd' in _['sequence-item'].get('mode', 'awd')
+  label for=cb-dtml-id;
+  dtml-else
+  label
+  /dtml-if
+  dtml-var propertyLabel(id) html_quote/label
   /div
   /td
   td align=left valign=top
-
   dtml-if 'w' in _['sequence-item'].get('mode', 'awd')
   dtml-if type == 'int'
   input type=text name=dtml-id;:dtml-type;
-   size=35 value=dtml-if hasProperty(id)dtml-var '%s' % 
getProperty(id) html_quote/dtml-if
+   size=35 value=dtml-if hasProperty(id)dtml-var
+'%s' % getProperty(id) html_quote/dtml-if /
   dtml-elif type == 'long'
   input type=text name=dtml-id;:dtml-type; size=35
-   value=dtml-if hasProperty(id)dtml-var ('%s' % getProperty(id)) 
html_quote/dtml-if
+   value=dtml-if hasProperty(id)dtml-var
+('%s' % getProperty(id)) html_quote/dtml-if /
   dtml-elif type in ('float', 'date')
-  input type=text name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']dtml-type; size=35
-   value=dtml-var getProperty(id) html_quote
+  input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
+   value=dtml-var getProperty(id) html_quote /
   dtml-elif type in ['string','ustring']
-  input type=text name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']dtml-type; size=35
-   value=dtml-var getProperty(id) html_quote
+  input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
+   value=dtml-var getProperty(id) html_quote /
   dtml-elif type=='boolean'
-  input type=checkbox name=dtml-id;:boolean size=35
-   dtml-if getProperty(id)CHECKED/dtml-if
+  input type=checkbox name=dtml-id;:dtml-type; size=35
+   dtml-if getProperty(id)checked=checked/dtml-if /
   dtml-elif type in ['tokens','utokens']
-  input type=text name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']dtml-type; size=35
-   value=dtml-in getProperty(id)dtml-sequence-item; /dtml-in
+  input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
+   value=dtml-in getProperty(id)dtml-sequence-item; /dtml-in /
   dtml-elif type in ['text','utext']
-  textarea class=form-element name=dtml-id;:dtml-var
-   REQUEST['management_page_charset_tag']dtml-type;
+  textarea class=form-element name=dtml-id;:dtml-charset_tag;dtml-type;
rows=6 cols=35dtml-var getProperty(id) html_quote/textarea
   dtml-elif type in ['lines','ulines']
-  textarea class=form-element name=dtml-id;:dtml-var
-   REQUEST['management_page_charset_tag']dtml-type; rows=6
-   cols=35dtml-in getProperty(id)dtml-sequence-item;dtml-if
+  textarea class=form-element name=dtml-id;:dtml-charset_tag;dtml-type;
+   rows=6 cols=35dtml-in getProperty(id)dtml-sequence-item;dtml-if
sequence-enddtml-elsedtml-var '\n'/dtml-if/dtml-in/textarea
 
   dtml-elif type=='selection'
 
 dtml-if hasProperty(select_variable)
 div class=form-element
-select name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']text
+select name=dtml-id;:dtml-charset_tag;text
   dtml-in getProperty(select_variable)
  option
-  dtml-if _['sequence-item']==getProperty(id)SELECTED/dtml-if
+  dtml-if 
_['sequence-item']==getProperty(id)selected=selected/dtml-if
   dtml-sequence-item;/option
   /dtml-in
 /select
 /div
 dtml-elif _.has_key(select_variable)
 div class=form-element
-select name=dtml-id;:dtml-var 
REQUEST['management_page_charset_tag']text
+select name=dtml-id;:dtml-charset_tag;text
   dtml-in _[select_variable]
  option
-  dtml-if _['sequence-item']==getProperty(id)SELECTED/dtml-if
+  dtml-if 
_['sequence-item']==getProperty(id)selected=selected/dtml-if
   dtml-sequence-item;/option
   /dtml-in
 /select
@@ -133,24 +138,24 @@
 
 dtml-if hasProperty(select_variable)
 div class=form-element
-select name=dtml-id;:dtml-var 

[Zope-Checkins] SVN: Zope/trunk/src/OFS/dtml/properties.dtml - Fixed editing offset-naive 'date' properties in the ZMI.

2011-03-10 Thread Yvo Schubbe
Log message for revision 120841:
  - Fixed editing offset-naive 'date' properties in the ZMI.

Changed:
  U   Zope/trunk/src/OFS/dtml/properties.dtml

-=-
Modified: Zope/trunk/src/OFS/dtml/properties.dtml
===
--- Zope/trunk/src/OFS/dtml/properties.dtml 2011-03-10 11:09:15 UTC (rev 
120840)
+++ Zope/trunk/src/OFS/dtml/properties.dtml 2011-03-10 11:09:36 UTC (rev 
120841)
@@ -86,10 +86,11 @@
   input type=text name=dtml-id;:dtml-type; size=35
value=dtml-if hasProperty(id)dtml-var
 ('%s' % getProperty(id)) html_quote/dtml-if /
-  dtml-elif type in ('float', 'date')
+  dtml-elif type == 'date' and not _.same_type(getProperty(id), '')
+  and getProperty(id).timezoneNaive()
   input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
-   value=dtml-var getProperty(id) html_quote /
-  dtml-elif type in ['string','ustring']
+   value=dtml-var str(getProperty(id)).rsplit(' ', 1)[0] html_quote /
+  dtml-elif type in ['date', 'float', 'string', 'ustring']
   input type=text name=dtml-id;:dtml-charset_tag;dtml-type; size=35
value=dtml-var getProperty(id) html_quote /
   dtml-elif type=='boolean'

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


[Zope-Checkins] SVN: Zope/trunk/ - If `IBrowserPage` is provided by a view, form input is decoded.

2011-03-08 Thread Yvo Schubbe
Log message for revision 120792:
  - If `IBrowserPage` is provided by a view, form input is decoded.

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  UU  Zope/trunk/src/ZPublisher/HTTPRequest.py
  UU  Zope/trunk/src/ZPublisher/Publish.py
  UU  Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2011-03-08 07:57:53 UTC (rev 120791)
+++ Zope/trunk/doc/CHANGES.rst  2011-03-08 09:36:31 UTC (rev 120792)
@@ -28,6 +28,9 @@
 Features Added
 ++
 
+- ZPublisher: If `IBrowserPage` is provided by a view, form input is decoded.
+  This makes it easier to use ``zope.formlib`` and ``z3c.form`` in Zope 2.
+
 - Report success or failure (when known) of creating a new user with
   the addzope2user script.
 

Modified: Zope/trunk/src/ZPublisher/HTTPRequest.py
===
--- Zope/trunk/src/ZPublisher/HTTPRequest.py2011-03-08 07:57:53 UTC (rev 
120791)
+++ Zope/trunk/src/ZPublisher/HTTPRequest.py2011-03-08 09:36:31 UTC (rev 
120792)
@@ -40,7 +40,6 @@
 from ZPublisher.BaseRequest import BaseRequest
 from ZPublisher.BaseRequest import quote
 from ZPublisher.Converters import get_converter
-from ZPublisher.HTTPResponse import HTTPResponse
 from ZPublisher.maybe_lock import allocate_lock
 
 # Flags
@@ -1150,6 +1149,12 @@
 other['PATH_INFO'] = path = %s/%s % (path,meth)
 self._hacked_path = 1
 
+def postProcessInputs(self):
+Process the values in request.form to decode strings to unicode.
+
+for name, value in self.form.iteritems():
+self.form[name] = _decode(value, default_encoding)
+
 def resolve_url(self, url):
 # Attempt to resolve a url into an object in the Zope
 # namespace. The url must be a fully-qualified url. The
@@ -1754,3 +1759,16 @@
 result.append((k, v))
 
 return result
+
+def _decode(value, charset):
+Recursively look for string values and decode.
+
+if isinstance(value, list):
+return [_decode(v, charset) for v in value]
+elif isinstance(value, tuple):
+return tuple(_decode(v, charset) for v in value)
+elif isinstance(value, dict):
+return dict((k, _decode(v, charset)) for k, v in value.iteritems())
+elif isinstance(value, str):
+return unicode(value, charset, 'replace')
+return value


Property changes on: Zope/trunk/src/ZPublisher/HTTPRequest.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/ZPublisher/Publish.py
===
--- Zope/trunk/src/ZPublisher/Publish.py2011-03-08 07:57:53 UTC (rev 
120791)
+++ Zope/trunk/src/ZPublisher/Publish.py2011-03-08 09:36:31 UTC (rev 
120792)
@@ -15,19 +15,26 @@
 
 import sys, os
 import transaction
-from Response import Response
-from Request import Request
-from maybe_lock import allocate_lock
-from mapply import mapply
+
 from zExceptions import Redirect
+from zope.event import notify
 from zope.publisher.interfaces import ISkinnable
+from zope.publisher.interfaces.browser import IBrowserPage
 from zope.publisher.skinnable import setDefaultSkin
 from zope.security.management import newInteraction, endInteraction
-from zope.event import notify
 
-from pubevents import PubStart, PubSuccess, PubFailure, \
- PubBeforeCommit, PubAfterTraversal, PubBeforeAbort
+from .mapply import mapply
+from .maybe_lock import allocate_lock
+from .pubevents import PubAfterTraversal
+from .pubevents import PubBeforeAbort
+from .pubevents import PubBeforeCommit
+from .pubevents import PubFailure
+from .pubevents import PubStart
+from .pubevents import PubSuccess
+from .Request import Request
+from .Response import Response
 
+
 class Retry(Exception):
 Raise this to retry a request
 
@@ -114,6 +121,9 @@
 
 object=request.traverse(path, validated_hook=validated_hook)
 
+if IBrowserPage.providedBy(object):
+request.postProcessInputs()
+
 notify(PubAfterTraversal(request))
 
 if transactions_manager:


Property changes on: Zope/trunk/src/ZPublisher/Publish.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
===
--- Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py  2011-03-08 07:57:53 UTC 
(rev 120791)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py  2011-03-08 09:36:31 UTC 
(rev 120792)
@@ -1,5 +1,8 @@
 import unittest
 
+from zope.testing.cleanup import cleanUp
+
+
 class RecordTests(unittest.TestCase):
 
 def test_repr(self):
@@ -11,8 +14,12 @@
 d = eval(r)
 self.assertEqual(d, rec.__dict__)
 
+
 class 

[Zope-Checkins] SVN: Zope/trunk/ - Marked `processInputs` and `setPageEncoding` as deprecated.

2011-03-08 Thread Yvo Schubbe
Log message for revision 120793:
  - Marked `processInputs` and `setPageEncoding` as deprecated.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  UU  Zope/trunk/src/Products/Five/browser/decode.py
  UU  Zope/trunk/src/Products/Five/browser/tests/test_decode.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2011-03-08 09:36:31 UTC (rev 120792)
+++ Zope/trunk/doc/CHANGES.rst  2011-03-08 09:39:49 UTC (rev 120793)
@@ -54,6 +54,10 @@
 Restructuring
 +
 
+- Five.browser: Marked `processInputs` and `setPageEncoding` as deprecated.
+  `processInputs` was replaced by the `postProcessInputs` request method and
+  the charset negotiation done by `setPageEncoding` was never fully supported.
+
 - Factored out the `Products.ZCatalog` and `Products.PluginIndexes` packages
   into a new `Products.ZCatalog` distribution.
 

Modified: Zope/trunk/src/Products/Five/browser/decode.py
===
--- Zope/trunk/src/Products/Five/browser/decode.py  2011-03-08 09:36:31 UTC 
(rev 120792)
+++ Zope/trunk/src/Products/Five/browser/decode.py  2011-03-08 09:39:49 UTC 
(rev 120793)
@@ -15,6 +15,8 @@
 encoding.
 
 
+from warnings import warn
+
 from zope.publisher.browser import isCGI_NAME
 from zope.i18n.interfaces import IUserPreferredCharsets
 
@@ -34,7 +36,10 @@
 Recursively look for values (e.g. elements of lists, tuples or dicts)
 and attempt to decode.
 
-
+warn(u'processInputValue() is deprecated and will be removed in Zope '
+ u'2.16.',
+ DeprecationWarning, stacklevel=2)
+
 if isinstance(value, list):
 return [processInputValue(v, charsets) for v in value]
 elif isinstance(value, tuple):
@@ -53,14 +58,18 @@
 the passed-in list of charsets. If none are passed in, look up the user's
 preferred charsets. The default is to use utf-8.
 
-
+warn(u'processInputs() is deprecated and will be removed in Zope 2.16. If '
+ u'your view implements IBrowserPage, similar processing is now '
+ u'executed automatically.',
+ DeprecationWarning, stacklevel=2)
+
 if charsets is None:
 envadapter = IUserPreferredCharsets(request, None)
 if envadapter is None:
 charsets = ['utf-8']
 else:
 charsets = envadapter.getPreferredCharsets() or ['utf-8']
-
+
 for name, value in request.form.items():
 if not (isCGI_NAME(name) or name.startswith('HTTP_')):
 request.form[name] = processInputValue(value, charsets)
@@ -70,6 +79,10 @@
 ZPublisher uses the value of this header to determine how to
 encode unicode data for the browser.
 
+warn(u'setPageEncoding() is deprecated and will be removed in Zope 2.16. '
+ u'It is recommended to let the ZPublisher use the default_encoding. '
+ u'Please consider setting default-zpublisher-encoding to utf-8.',
+ DeprecationWarning, stacklevel=2)
 envadapter = IUserPreferredCharsets(request)
 charsets = envadapter.getPreferredCharsets() or ['utf-8']
 request.RESPONSE.setHeader(


Property changes on: Zope/trunk/src/Products/Five/browser/decode.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/Products/Five/browser/tests/test_decode.py
===
--- Zope/trunk/src/Products/Five/browser/tests/test_decode.py   2011-03-08 
09:36:31 UTC (rev 120792)
+++ Zope/trunk/src/Products/Five/browser/tests/test_decode.py   2011-03-08 
09:39:49 UTC (rev 120793)
@@ -18,7 +18,9 @@
 
 Testing processInputs
 
+   import warnings
from Products.Five.browser.decode import processInputs
+
charsets = ['iso-8859-1']
class DummyRequest:
   ... form = {}
@@ -27,59 +29,75 @@
 Strings are converted to unicode::
 
request.form['foo'] = u'f\xf6\xf6'.encode('iso-8859-1')
-   processInputs(request, charsets)
+   with warnings.catch_warnings():
+  ... warnings.simplefilter('ignore')
+  ... processInputs(request, charsets)
request.form['foo'] == u'f\xf6\xf6'
   True
 
 Strings in lists are converted to unicode::
 
request.form['foo'] = [u'f\xf6\xf6'.encode('iso-8859-1')]
-   processInputs(request, charsets)
+   with warnings.catch_warnings():
+  ... warnings.simplefilter('ignore')
+  ... processInputs(request, charsets)
request.form['foo'] == [u'f\xf6\xf6']
   True
 
 Strings in tuples are converted to unicode::
 
request.form['foo'] = (u'f\xf6\xf6'.encode('iso-8859-1'),)
-   processInputs(request, charsets)
+   with warnings.catch_warnings():
+  ... warnings.simplefilter('ignore')
+  ... processInputs(request, charsets)
request.form['foo'] == 

[Zope-Checkins] SVN: Zope/trunk/src/App/ApplicationManager.py - use Zope2.DB instead of Globals.DB

2011-03-07 Thread Yvo Schubbe
Log message for revision 120772:
  - use Zope2.DB instead of Globals.DB

Changed:
  UU  Zope/trunk/src/App/ApplicationManager.py

-=-
Modified: Zope/trunk/src/App/ApplicationManager.py
===
--- Zope/trunk/src/App/ApplicationManager.py2011-03-05 15:55:59 UTC (rev 
120771)
+++ Zope/trunk/src/App/ApplicationManager.py2011-03-07 10:09:44 UTC (rev 
120772)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 System management components
@@ -217,8 +217,8 @@
 } for n in rd]
 
 def dbconnections(self):
-import Globals  # for data
-return Globals.DB.connectionDebugInfo()
+import Zope2  # for data
+return Zope2.DB.connectionDebugInfo()
 
 
 # Profiling support
@@ -481,4 +481,3 @@
 db_name = ApplicationManager.db_name.im_func
 db_size = ApplicationManager.db_size.im_func
 manage_pack = ApplicationManager.manage_pack.im_func
-


Property changes on: Zope/trunk/src/App/ApplicationManager.py
___
Deleted: cvs2svn:cvs-rev
   - 1.94

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


[Zope-Checkins] SVN: Zope/trunk/src/Zope2/Startup/ - removed redundant Globals.DevelopmentMode initializations (setConfiguration is responsible for this)

2011-03-07 Thread Yvo Schubbe
Log message for revision 120774:
  - removed redundant Globals.DevelopmentMode initializations (setConfiguration 
is responsible for this)

Changed:
  UU  Zope/trunk/src/Zope2/Startup/__init__.py
  UU  Zope/trunk/src/Zope2/Startup/handlers.py

-=-
Modified: Zope/trunk/src/Zope2/Startup/__init__.py
===
--- Zope/trunk/src/Zope2/Startup/__init__.py2011-03-07 10:12:24 UTC (rev 
120773)
+++ Zope/trunk/src/Zope2/Startup/__init__.py2011-03-07 10:24:42 UTC (rev 
120774)
@@ -11,7 +11,6 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##
-
  Startup package.  Responsible for startup configuration of Zope 
 
 import logging
@@ -123,10 +122,8 @@
 logger.error(msg)
 
 def setupPublisher(self):
-import Globals # to set data
 import ZPublisher.HTTPRequest
 import ZPublisher.Publish
-Globals.DevelopmentMode = self.cfg.debug_mode
 ZPublisher.Publish.set_default_debug_mode(self.cfg.debug_mode)
 ZPublisher.Publish.set_default_authentication_realm(
 self.cfg.http_realm)


Property changes on: Zope/trunk/src/Zope2/Startup/__init__.py
___
Deleted: cvs2svn:cvs-rev
   - 1.25

Modified: Zope/trunk/src/Zope2/Startup/handlers.py
===
--- Zope/trunk/src/Zope2/Startup/handlers.py2011-03-07 10:12:24 UTC (rev 
120773)
+++ Zope/trunk/src/Zope2/Startup/handlers.py2011-03-07 10:24:42 UTC (rev 
120774)
@@ -20,8 +20,6 @@
 
 def debug_mode(value):
 value and _setenv('Z_DEBUG_MODE', '1')
-import Globals # to set value
-Globals.DevelopmentMode = bool(value)
 return value
 
 def locale(value):


Property changes on: Zope/trunk/src/Zope2/Startup/handlers.py
___
Deleted: cvs2svn:cvs-rev
   - 1.17

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/TemporaryFolder/patchfs.py - removed ancient migration script

2011-03-07 Thread Yvo Schubbe
Log message for revision 120776:
  - removed ancient migration script

Changed:
  D   Zope/trunk/src/Products/TemporaryFolder/patchfs.py

-=-
Deleted: Zope/trunk/src/Products/TemporaryFolder/patchfs.py
===
--- Zope/trunk/src/Products/TemporaryFolder/patchfs.py  2011-03-07 10:26:26 UTC 
(rev 120775)
+++ Zope/trunk/src/Products/TemporaryFolder/patchfs.py  2011-03-07 10:26:40 UTC 
(rev 120776)
@@ -1,49 +0,0 @@
-# Utility program to patch Data.fs.in to include a temporary folder, browser
-# id manager, and session data manager
-
-#
-# Copyright (c) 2002 Zope Foundation and Contributors.
-#
-# 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
-#
-
-import os
-import sys
-
-import Globals # for data
-from ZODB import DB
-from ZODB import FileStorage
-import transaction
-
-from Products.Sessions.BrowserIdManager import BrowserIdManager
-from Products.Sessions.SessionDataManager import SessionDataManager
-from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
-
-fs = FileStorage.FileStorage(os.path.join(Globals.data_dir,'Data.fs.in'))
-db = DB(fs)
-conn = db.open()
-root = conn.root()
-app = root['Application']
-
-print Patching Data.fs.in
-
-tf = MountedTemporaryFolder('temp_folder','Temporary Folder')
-app._setObject('temp_folder', tf)
-
-bid = BrowserIdManager('browser_id_manager', 'Browser Id Manager')
-app._setObject('browser_id_manager', bid)
-
-sdm = r.SessionDataManager('session_data_manager',
-   title='Session Data Manager',
-   path='/temp_folder/transient_container',
-   automatic=0)
-app._setObject('session_data_manager', sdm)
-
-app._p_changed = 1
-
-transaction.commit()

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


[Zope-Checkins] SVN: Zope/trunk/src/ - removed unused Globals import

2011-03-07 Thread Yvo Schubbe
Log message for revision 120777:
  - removed unused Globals import

Changed:
  UU  Zope/trunk/src/App/Product.py
  U   Zope/trunk/src/OFS/ObjectManager.py

-=-
Modified: Zope/trunk/src/App/Product.py
===
--- Zope/trunk/src/App/Product.py   2011-03-07 10:26:40 UTC (rev 120776)
+++ Zope/trunk/src/App/Product.py   2011-03-07 10:31:11 UTC (rev 120777)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 Product objects
@@ -204,8 +204,6 @@
 def initializeProduct(productp, name, home, app):
 # Initialize a persistent product
 assert doInstall()
-
-import Globals  # to set data
 fver = ''
 
 if hasattr(productp, '__import_error__'):
@@ -289,4 +287,3 @@
 def doInstall():
 from App.config import getConfiguration
 return getConfiguration().enable_product_installation
-


Property changes on: Zope/trunk/src/App/Product.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/OFS/ObjectManager.py
===
--- Zope/trunk/src/OFS/ObjectManager.py 2011-03-07 10:26:40 UTC (rev 120776)
+++ Zope/trunk/src/OFS/ObjectManager.py 2011-03-07 10:31:11 UTC (rev 120777)
@@ -85,8 +85,6 @@
 # only check that the id string contains no illegal chars;
 # check_valid_id() will be called again later with allow_dup
 # set to false before the object is added.
-import Globals  # for data
-
 if not id or not isinstance(id, str):
 if isinstance(id, unicode):
 id = escape(id)

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


[Zope-Checkins] SVN: Zope/trunk/src/ - use getConfiguration() instead of Globals

2011-03-07 Thread Yvo Schubbe
Log message for revision 120778:
  - use getConfiguration() instead of Globals

Changed:
  UU  Zope/trunk/src/App/ImageFile.py
  UU  Zope/trunk/src/App/special_dtml.py
  U   Zope/trunk/src/HelpSys/HelpTopic.py
  UU  Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py
  UU  Zope/trunk/src/ZPublisher/xmlrpc.py
  UU  Zope/trunk/src/Zope2/App/startup.py
  UU  Zope/trunk/src/Zope2/App/zcml.py

-=-
Modified: Zope/trunk/src/App/ImageFile.py
===
--- Zope/trunk/src/App/ImageFile.py 2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/App/ImageFile.py 2011-03-07 10:34:58 UTC (rev 120778)
@@ -7,12 +7,11 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 Image object that is stored in a file
 
-import os
 import os.path
 import stat
 import time
@@ -47,7 +46,6 @@
 security = ClassSecurityInfo()
 
 def __init__(self, path, _prefix=None):
-import Globals  # for data
 if _prefix is None:
 _prefix=getattr(getConfiguration(), 'softwarehome', None) or PREFIX
 if not os.path.isabs(path):
@@ -57,7 +55,7 @@
 # _prefix is ignored if path is absolute
 path = os.path.join(_prefix, path)
 self.path=path
-if Globals.DevelopmentMode:
+if getConfiguration().debug_mode:
 # In development mode, a shorter time is handy
 max_age = 60 # One minute
 else:


Property changes on: Zope/trunk/src/App/ImageFile.py
___
Deleted: cvs2svn:cvs-rev
   - 1.20

Modified: Zope/trunk/src/App/special_dtml.py
===
--- Zope/trunk/src/App/special_dtml.py  2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/App/special_dtml.py  2011-03-07 10:34:58 UTC (rev 120778)
@@ -7,16 +7,21 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 
-import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys
+import os
+import sys
+from logging import getLogger
 from types import InstanceType
-from logging import getLogger
+
+import DocumentTemplate
+import MethodObject
+import Persistence
+from App import Common
 from App.config import getConfiguration
 
-
 LOG = getLogger('special_dtml')
 
 import Zope2
@@ -49,7 +54,7 @@
 apply(ClassicHTMLFile.inheritedAttribute('__init__'), args, kw)
 
 def _cook_check(self):
-if Globals.DevelopmentMode:
+if getConfiguration().debug_mode:
 __traceback_info__=self.raw
 try:mtime=os.stat(self.raw)[8]
 except: mtime=0


Property changes on: Zope/trunk/src/App/special_dtml.py
___
Deleted: cvs2svn:cvs-rev
   - 1.26

Modified: Zope/trunk/src/HelpSys/HelpTopic.py
===
--- Zope/trunk/src/HelpSys/HelpTopic.py 2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/HelpSys/HelpTopic.py 2011-03-07 10:34:58 UTC (rev 120778)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 import os
@@ -17,6 +17,7 @@
 from AccessControl.Permissions import view as View
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Acquisition import Implicit
+from App.config import getConfiguration
 from App.ImageFile import ImageFile
 from App.special_dtml import DTMLFile
 from App.special_dtml import HTML
@@ -26,6 +27,7 @@
 from OFS.SimpleItem import Item
 from Persistence import Persistent
 
+
 class HelpTopicBase:
 Mix-in Help Topic support class
 
@@ -133,8 +135,7 @@
 self._v_last_read = mtime
 
 def _check_for_update(self):
-import Globals
-if Globals.DevelopmentMode:
+if getConfiguration().debug_mode:
 try:mtime=os.stat(self.file)[8]
 except: mtime=0
 if mtime != self._v_last_read:

Modified: Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py
===
--- 

[Zope-Checkins] SVN: Zope/trunk/src/Zope2/Startup/ - multisection has no 'dataype' (and no 'datatype') attribute

2011-03-04 Thread Yvo Schubbe
Log message for revision 120747:
  - multisection has no 'dataype' (and no 'datatype') attribute

Changed:
  UU  Zope/trunk/src/Zope2/Startup/tests/test_warnfilter.py
  UU  Zope/trunk/src/Zope2/Startup/zopeschema.xml

-=-
Modified: Zope/trunk/src/Zope2/Startup/tests/test_warnfilter.py
===
--- Zope/trunk/src/Zope2/Startup/tests/test_warnfilter.py   2011-03-04 
11:22:09 UTC (rev 120746)
+++ Zope/trunk/src/Zope2/Startup/tests/test_warnfilter.py   2011-03-04 
16:55:25 UTC (rev 120747)
@@ -87,6 +87,7 @@
message .*test.*
 /warnfilter
 )
+self.assertEqual(len(conf.warnfilters), 2)
 self.assertRaises(TestSchemaWarning, self._dowarning1)
 self.assertRaises(UserWarning, self._dowarning2)
 


Property changes on: Zope/trunk/src/Zope2/Startup/tests/test_warnfilter.py
___
Deleted: cvs2svn:cvs-rev
   - 1.3

Modified: Zope/trunk/src/Zope2/Startup/zopeschema.xml
===
--- Zope/trunk/src/Zope2/Startup/zopeschema.xml 2011-03-04 11:22:09 UTC (rev 
120746)
+++ Zope/trunk/src/Zope2/Startup/zopeschema.xml 2011-03-04 16:55:25 UTC (rev 
120747)
@@ -263,8 +263,7 @@
 
   !-- schema begins  --
 
-  multisection type=warnfilter attribute=warnfilters name=*
-dataype=zLOG.warn_filter_handler
+  multisection type=warnfilter name=* attribute=warnfilters
 !-- from zLOG --
 description
 A multisection which allows a user to set up a Python warning filter.


Property changes on: Zope/trunk/src/Zope2/Startup/zopeschema.xml
___
Deleted: cvs2svn:cvs-rev
   - 1.32

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


[Zope-Checkins] SVN: Zope/branches/2.12/ - corrected copyright information shown in the ZMI

2011-02-28 Thread Yvo Schubbe
Log message for revision 120590:
  - corrected copyright information shown in the ZMI

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/App/dtml/copyright.dtml
  U   Zope/branches/2.12/src/App/dtml/menu.dtml

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2011-02-28 08:08:31 UTC (rev 120589)
+++ Zope/branches/2.12/doc/CHANGES.rst  2011-02-28 10:37:26 UTC (rev 120590)
@@ -11,6 +11,7 @@
 Bugs Fixed
 ++
 
+- Corrected copyright information shown in the ZMI.
 
 2.12.16 (2011-02-23)
 

Modified: Zope/branches/2.12/src/App/dtml/copyright.dtml
===
--- Zope/branches/2.12/src/App/dtml/copyright.dtml  2011-02-28 08:08:31 UTC 
(rev 120589)
+++ Zope/branches/2.12/src/App/dtml/copyright.dtml  2011-02-28 10:37:26 UTC 
(rev 120590)
@@ -15,7 +15,7 @@
 
 H2Zope Public License (ZPL) Version 2.1/H2
 h3This software is Copyright copy;
-a href=http://www.zope.com/; TARGET=_topZope Corporation/atrade; and
+a href=http://www.zopefoundation.org/; target=_topZope Foundation/a and
 Contributors. All rights reserved./h3
 
 p
@@ -129,42 +129,7 @@
 PERFORMANCE OF THIS SOFTWARE./strong/p
 
 hr
-pZope uses the xmlrpclib module:/p
 
-Copyright copy; 1999 by Secret Labs ABbr
-Copyright copy; 1999 by Fredrik Lundh/p
-
-pBy obtaining, using, and/or copying this software and/or its
-associated documentation, you agree that you have read, understood,
-and will comply with the following terms and conditions:/p
-
-pPermission to use, copy, modify, and distribute this software and its
-associated documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appears in all
-copies, and that both that copyright notice and this permission notice
-appear in supporting documentation, and that the name of Secret Labs
-AB or the author not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission./p
-
-pstrongSECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 
TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE./strong/p
-
-hr
-pZope uses the C expat library by James Clark, for parsing XML text./p
-
-PCopyright (c) 1998, 1999 Zope Foundation and Contributors
-HREF=http://www.mozilla.org/NPL/NPL-1_1Final.html;Mozilla Public
-License Version 1.1/A.
-/p
-
-hr
-
 A NAME=CREDITS
 
 H3Zope Credits/H3

Modified: Zope/branches/2.12/src/App/dtml/menu.dtml
===
--- Zope/branches/2.12/src/App/dtml/menu.dtml   2011-02-28 08:08:31 UTC (rev 
120589)
+++ Zope/branches/2.12/src/App/dtml/menu.dtml   2011-02-28 10:37:26 UTC (rev 
120590)
@@ -49,7 +49,7 @@
   td valign=top nowrap
   strong
   a href=manage_copyright target=manage_main
-  copy; Zope Corporation
+  copy; Zope Foundation
   /a
   /strong
   /td

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


[Zope-Checkins] SVN: Zope/trunk/src/App/dtml/ - corrected copyright information shown in the ZMI

2011-02-28 Thread Yvo Schubbe
Log message for revision 120592:
  - corrected copyright information shown in the ZMI

Changed:
  U   Zope/trunk/src/App/dtml/copyright.dtml
  U   Zope/trunk/src/App/dtml/menu.dtml

-=-
Modified: Zope/trunk/src/App/dtml/copyright.dtml
===
--- Zope/trunk/src/App/dtml/copyright.dtml  2011-02-28 10:38:24 UTC (rev 
120591)
+++ Zope/trunk/src/App/dtml/copyright.dtml  2011-02-28 10:38:57 UTC (rev 
120592)
@@ -15,7 +15,7 @@
 
 H2Zope Public License (ZPL) Version 2.1/H2
 h3This software is Copyright copy;
-a href=http://www.zope.com/; TARGET=_topZope Corporation/atrade; and
+a href=http://www.zopefoundation.org/; target=_topZope Foundation/a and
 Contributors. All rights reserved./h3
 
 p
@@ -129,42 +129,7 @@
 PERFORMANCE OF THIS SOFTWARE./strong/p
 
 hr
-pZope uses the xmlrpclib module:/p
 
-Copyright copy; 1999 by Secret Labs ABbr
-Copyright copy; 1999 by Fredrik Lundh/p
-
-pBy obtaining, using, and/or copying this software and/or its
-associated documentation, you agree that you have read, understood,
-and will comply with the following terms and conditions:/p
-
-pPermission to use, copy, modify, and distribute this software and its
-associated documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appears in all
-copies, and that both that copyright notice and this permission notice
-appear in supporting documentation, and that the name of Secret Labs
-AB or the author not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission./p
-
-pstrongSECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 
TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE./strong/p
-
-hr
-pZope uses the C expat library by James Clark, for parsing XML text./p
-
-PCopyright (c) 1998, 1999 Zope Foundation and Contributors
-HREF=http://www.mozilla.org/NPL/NPL-1_1Final.html;Mozilla Public
-License Version 1.1/A.
-/p
-
-hr
-
 A NAME=CREDITS
 
 H3Zope Credits/H3

Modified: Zope/trunk/src/App/dtml/menu.dtml
===
--- Zope/trunk/src/App/dtml/menu.dtml   2011-02-28 10:38:24 UTC (rev 120591)
+++ Zope/trunk/src/App/dtml/menu.dtml   2011-02-28 10:38:57 UTC (rev 120592)
@@ -49,7 +49,7 @@
   td valign=top nowrap
   strong
   a href=manage_copyright target=manage_main
-  copy; Zope Corporation
+  copy; Zope Foundation
   /a
   /strong
   /td

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


[Zope-Checkins] SVN: Zope/trunk/src/ - fixed html of some basic ZMI pages

2011-02-28 Thread Yvo Schubbe
Log message for revision 120594:
  - fixed html of some basic ZMI pages
  - removed special support for ancient browsers
  - removed code that tries to change window.status

Changed:
  UU  Zope/trunk/src/App/dtml/copyright.dtml
  UU  Zope/trunk/src/App/dtml/cpContents.dtml
  UU  Zope/trunk/src/App/dtml/manage.dtml
  UU  Zope/trunk/src/App/dtml/manage_page_header.dtml
  UU  Zope/trunk/src/App/dtml/manage_page_style.css.dtml
  UU  Zope/trunk/src/App/dtml/manage_top_frame.dtml
  UU  Zope/trunk/src/App/dtml/manage_zmi_prefs.dtml
  UU  Zope/trunk/src/App/dtml/menu.dtml
  UU  Zope/trunk/src/App/dtml/zope_quick_start.dtml
  U   Zope/trunk/src/OFS/dtml/main.dtml

-=-
Modified: Zope/trunk/src/App/dtml/copyright.dtml
===
--- Zope/trunk/src/App/dtml/copyright.dtml  2011-02-28 11:00:33 UTC (rev 
120593)
+++ Zope/trunk/src/App/dtml/copyright.dtml  2011-02-28 12:09:34 UTC (rev 
120594)
@@ -1,19 +1,19 @@
-!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN 
http://www.w3.org/TR/REC-html40/loose.dtd;
+!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html
 head
 titleZope Copyright/title
 /head
 body bgcolor=#ff link=#99 alink=#99 vlink=#99
 
-P align=center
+p align=center
 a href=#ZPLZope License/a |
 a href=#PYTHONPython License/a |
 a href=#CREDITSZope Credits/a
-/P
+/p
 
-A NAME=ZPL
+a name=ZPL /
 
-H2Zope Public License (ZPL) Version 2.1/H2
+h2Zope Public License (ZPL) Version 2.1/h2
 h3This software is Copyright copy;
 a href=http://www.zopefoundation.org/; target=_topZope Foundation/a and
 Contributors. All rights reserved./h3
@@ -91,19 +91,18 @@
 accompanying credits file.
 /p
 
-hr
+hr /
 
-A NAME=PYTHON
+a name=PYTHON /
 
-H3
-img src=dtml-BASEPATH1;/p_/PyPoweredSmall_Gif
-This software is powered by a href=http://www.python.org/; 
TARGET=_topPython/a!
-/H3
+h3
+img src=dtml-BASEPATH1;/p_/PyPoweredSmall_Gif alt=Python powered /
+This software is powered by a href=http://www.python.org/; 
target=_topPython/a!
+/h3
 pCopyright copy; 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
-The Netherlands./p
+The Netherlands.
+br /All Rights Reserved/p
 
-pcenterAll Rights Reserved/center/p
-
 pPermission to use, copy, modify, and distribute this software and its
 documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
@@ -128,72 +127,71 @@
 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 PERFORMANCE OF THIS SOFTWARE./strong/p
 
-hr
+hr /
 
-A NAME=CREDITS
+a name=CREDITS /
 
-H3Zope Credits/H3
+h3Zope Credits/h3
 
 
-P
+p
   The Zope software receives contributions from far and wide.  Here's
   the Zope Hall of Fame:
-/P
-UL
+/p
+ul
 
-LIJeff Bauer is Zope Dude Number One.  Jeff took over PCGI and
-kept pushing it forward through the years./LI
+liJeff Bauer is Zope Dude Number One.  Jeff took over PCGI and
+kept pushing it forward through the years./li
 
-LISam Rushing worked with us at Zope Corporation to make Medusa
-the publishing platform for ZServer and the concurrency of Zope2./LI
+liSam Rushing worked with us at Zope Corporation to make Medusa
+the publishing platform for ZServer and the concurrency of Zope2./li
 
-LIA subset of windows guru Mark Hammond's win32 extensions are
-bundled with win32 binary distributions of Zope.
+liA subset of windows guru Mark Hammond's win32 extensions are
+bundled with win32 binary distributions of Zope./li
 
-LIMartijn Pieters and Brian Hooper contributed the DTML 'in' tag reverse
-attribute./LI
+liMartijn Pieters and Brian Hooper contributed the DTML 'in' tag reverse
+attribute./li
 
-LIPhillip Eby contributed the DTML codelet/code tag and many
+liPhillip Eby contributed the DTML codelet/code tag and many
   other useful ideas, including the inspiration for the DTML
   codecall/code, codewith/code and codereturn/code
-  tags./LI
+  tags./li
 
-LIThe DateTime module was based on work from Ted Horst./LI
+liThe DateTime module was based on work from Ted Horst./li
 
-LIJordan Baker contributed the 'try' tag, something I've wanted
-for a long, long time./LI
+liJordan Baker contributed the 'try' tag, something I've wanted
+for a long, long time./li
 
-LIMartijn Pieters chipped in with a safe range function./LI
+liMartijn Pieters chipped in with a safe range function./li
 
-LIMichael Hauser came up with the name Zope./LI
+liMichael Hauser came up with the name Zope./li
 
-LIEric Kidd added support for a href=http://www.xmlrpc.com/;
-XML-RPC/a/LI
+liEric Kidd added support for a href=http://www.xmlrpc.com/;
+XML-RPC/a/li
 
-LIAndrew M. Kuchling wrote the initial version of mod_pcgi, making 
-him extremely cool in our book./LI
+liAndrew M. Kuchling wrote the 

[Zope-Checkins] SVN: Zope/branches/2.13/ - corrected a method name in the IReadInterface interface

2011-02-14 Thread Yvo Schubbe
Log message for revision 120307:
  - corrected a method name in the IReadInterface interface

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/Products/Five/utilities/interfaces.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2011-02-14 08:12:56 UTC (rev 120306)
+++ Zope/branches/2.13/doc/CHANGES.rst  2011-02-14 08:18:52 UTC (rev 120307)
@@ -11,6 +11,7 @@
 Bugs Fixed
 ++
 
+- Five: Corrected a method name in the IReadInterface interface.
 
 Features Added
 ++

Modified: Zope/branches/2.13/src/Products/Five/utilities/interfaces.py
===
--- Zope/branches/2.13/src/Products/Five/utilities/interfaces.py
2011-02-14 08:12:56 UTC (rev 120306)
+++ Zope/branches/2.13/src/Products/Five/utilities/interfaces.py
2011-02-14 08:18:52 UTC (rev 120307)
@@ -47,7 +47,7 @@
 List interfaces provided by the object.
 
 
-def getDirectlyProvidedNames():
+def getProvidedNames():
 List the names of interfaces provided by the object.
 
 


Property changes on: 
Zope/branches/2.13/src/Products/Five/utilities/interfaces.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/utilities/interfaces.py - corrected a method name in the IReadInterface interface

2011-02-14 Thread Yvo Schubbe
Log message for revision 120308:
  - corrected a method name in the IReadInterface interface

Changed:
  UU  Zope/trunk/src/Products/Five/utilities/interfaces.py

-=-
Modified: Zope/trunk/src/Products/Five/utilities/interfaces.py
===
--- Zope/trunk/src/Products/Five/utilities/interfaces.py2011-02-14 
08:18:52 UTC (rev 120307)
+++ Zope/trunk/src/Products/Five/utilities/interfaces.py2011-02-14 
08:19:27 UTC (rev 120308)
@@ -47,7 +47,7 @@
 List interfaces provided by the object.
 
 
-def getDirectlyProvidedNames():
+def getProvidedNames():
 List the names of interfaces provided by the object.
 
 


Property changes on: Zope/trunk/src/Products/Five/utilities/interfaces.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/trunk/src/webdav/tests/ - some test cleanup

2010-12-28 Thread Yvo Schubbe
Log message for revision 119193:
  - some test cleanup

Changed:
  _U  Zope/trunk/src/webdav/tests/__init__.py
  _U  Zope/trunk/src/webdav/tests/testCollection.py
  _U  Zope/trunk/src/webdav/tests/testEtagSupport.py
  _U  Zope/trunk/src/webdav/tests/testLockItem.py
  _U  Zope/trunk/src/webdav/tests/testNullResource.py
  UU  Zope/trunk/src/webdav/tests/testResource.py

-=-

Property changes on: Zope/trunk/src/webdav/tests/__init__.py
___
Deleted: svn:keywords
   - Id


Property changes on: Zope/trunk/src/webdav/tests/testCollection.py
___
Deleted: svn:keywords
   - Id


Property changes on: Zope/trunk/src/webdav/tests/testEtagSupport.py
___
Deleted: svn:keywords
   - Id


Property changes on: Zope/trunk/src/webdav/tests/testLockItem.py
___
Deleted: svn:keywords
   - Id


Property changes on: Zope/trunk/src/webdav/tests/testNullResource.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/webdav/tests/testResource.py
===
--- Zope/trunk/src/webdav/tests/testResource.py 2010-12-28 11:33:13 UTC (rev 
119192)
+++ Zope/trunk/src/webdav/tests/testResource.py 2010-12-28 12:07:27 UTC (rev 
119193)
@@ -1,4 +1,5 @@
 import unittest
+
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
 from AccessControl.SecurityManager import setSecurityPolicy
@@ -11,7 +12,7 @@
 from StringIO import StringIO
 from ZPublisher.HTTPRequest import HTTPRequest
 from ZPublisher.HTTPResponse import HTTPResponse
-
+
 if environ is None:
 environ = {}
 
@@ -24,56 +25,105 @@
 req = HTTPRequest(stdin, environ, resp)
 return req, resp
 
+
+class DummyLock:
+
+def isValid(self):
+return True
+
+
+class DummyContent(Implicit):
+
+def cb_isMoveable(self):
+return True
+
+def _checkId(self, *arg, **kw):
+return True
+
+def _verifyObjectPaste(self, *arg):
+return True
+
+
+class DummyRequest:
+
+def __init__(self, form, headers):
+self.form = form
+self.headers = headers
+
+def get_header(self, name, default):
+return self.headers.get(name, default)
+
+def get(self, name, default):
+return self.form.get(name, default)
+
+def __getitem__(self, name):
+return self.form[name]
+
+def physicalPathFromURL(self, *arg):
+return ['']
+
+
+class DummyResponse:
+
+def __init__(self):
+self.headers = {}
+
+def setHeader(self, name, value, *arg):
+self.headers[name] = value
+
+
+class _DummySecurityPolicy:
+
+def validate(self, *args, **kw):
+return True
+
+
 class TestResource(unittest.TestCase):
+
+def _getTargetClass(self):
+from webdav.Resource import Resource
+
+return Resource
+
+def _makeOne(self, *args, **kw):
+return self._getTargetClass()(*args, **kw)
+
 def setUp(self):
 self.app = DummyContent()
-self.app.acl_users = DummyUserFolder()
-self._policy = PermissiveSecurityPolicy()
-self._oldPolicy = setSecurityPolicy(self._policy)
-newSecurityManager(None, OmnipotentUser().__of__(self.app.acl_users))
+self._oldPolicy = setSecurityPolicy(_DummySecurityPolicy())
+newSecurityManager(None, object())
 
 def tearDown(self):
 noSecurityManager()
 setSecurityPolicy(self._oldPolicy)
 
-def _getTargetClass(self):
-from webdav.Resource import Resource
-return Resource
-
-def _makeOne(self):
-klass = self._getTargetClass()
-inst = klass()
-return inst
-
 def test_interfaces(self):
 from webdav.interfaces import IDAVResource
 from webdav.interfaces import IWriteLock
-Resource = self._getTargetClass()
 from zope.interface.verify import verifyClass
 
-verifyClass(IDAVResource, Resource)
-verifyClass(IWriteLock, Resource)
+verifyClass(IDAVResource, self._getTargetClass())
+verifyClass(IWriteLock, self._getTargetClass())
 
 def test_ms_author_via(self):
 import webdav
-from webdav.Resource import Resource
 
 default_settings = webdav.enable_ms_author_via
 try:
 req, resp = make_request_response()
-resource = Resource()
+resource = self._makeOne()
 resource.OPTIONS(req, resp)
 self.assert_(not resp.headers.has_key('ms-author-via'))
 
 webdav.enable_ms_author_via = True
 req, resp = make_request_response()
-resource = Resource()
+resource = self._makeOne()
  

[Zope-Checkins] SVN: Zope/branches/2.13/ - fixed permission check and error handling in DeleteCollection

2010-12-28 Thread Yvo Schubbe
Log message for revision 119194:
  - fixed permission check and error handling in DeleteCollection

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  U   Zope/branches/2.13/src/webdav/Collection.py
  U   Zope/branches/2.13/src/webdav/davcmds.py
  U   Zope/branches/2.13/src/webdav/tests/test_davcmds.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2010-12-28 12:07:27 UTC (rev 119193)
+++ Zope/branches/2.13/doc/CHANGES.rst  2010-12-28 12:14:38 UTC (rev 119194)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++
 
+- webdav: Fixed permission check and error handling in DeleteCollection.
+
 - LP 686664: WebDAV Lock Manager ZMI view wasn't accessible.
 
 Features Added

Modified: Zope/branches/2.13/src/webdav/Collection.py
===
--- Zope/branches/2.13/src/webdav/Collection.py 2010-12-28 12:07:27 UTC (rev 
119193)
+++ Zope/branches/2.13/src/webdav/Collection.py 2010-12-28 12:14:38 UTC (rev 
119194)
@@ -89,7 +89,7 @@
 url = urlfix(REQUEST['URL'], 'DELETE')
 name = unquote(filter(None, url.split( '/'))[-1])
 parent = self.aq_parent
-user = getSecurityManager().getUser()
+sm = getSecurityManager()
 token = None
 
 #if re.match(/Control_Panel,REQUEST['PATH_INFO']):
@@ -119,7 +119,7 @@
 if ifhdr.find(tok)  -1:
 token = tok
 cmd = DeleteCollection()
-result = cmd.apply(self, token, user, REQUEST['URL'])
+result = cmd.apply(self, token, sm, REQUEST['URL'])
 
 if result:
 # There were conflicts, so we need to report them

Modified: Zope/branches/2.13/src/webdav/davcmds.py
===
--- Zope/branches/2.13/src/webdav/davcmds.py2010-12-28 12:07:27 UTC (rev 
119193)
+++ Zope/branches/2.13/src/webdav/davcmds.py2010-12-28 12:14:38 UTC (rev 
119194)
@@ -18,6 +18,7 @@
 from urllib import quote
 
 import transaction
+from AccessControl.Permissions import delete_objects
 from AccessControl.SecurityManagement import getSecurityManager
 from Acquisition import aq_base
 from Acquisition import aq_parent
@@ -26,11 +27,12 @@
 from zExceptions import Forbidden
 
 from webdav.common import absattr
+from webdav.common import isDavCollection
+from webdav.common import Locked
+from webdav.common import PreconditionFailed
 from webdav.common import urlbase
 from webdav.common import urlfix
 from webdav.common import urljoin
-from webdav.common import isDavCollection
-from webdav.common import PreconditionFailed
 from webdav.interfaces import IWriteLock
 from webdav.LockItem import LockItem
 from webdav.xmltools import XmlParser
@@ -492,7 +494,7 @@
 checking *all* descendents (deletes on collections are always of depth
 infinite) for locks and if the locks match. 
 
-def apply(self, obj, token, user, url=None, result=None, top=1):
+def apply(self, obj, token, sm, url=None, result=None, top=1):
 if result is None:
 result = StringIO()
 url = urlfix(url, 'DELETE')
@@ -502,7 +504,7 @@
 parent = aq_parent(obj)
 
 islockable = IWriteLock.providedBy(obj)
-if parent and (not user.has_permission('Delete objects', parent)):
+if parent and (not sm.checkPermission(delete_objects, parent)):
 # User doesn't have permission to delete this object
 errmsg = 403 Forbidden
 elif islockable and obj.wl_isLocked():
@@ -514,8 +516,10 @@
 
 if errmsg:
 if top and (not iscol):
-err = errmsg[4:]
-raise err
+if errmsg == 403 Forbidden:
+raise Forbidden()
+if errmsg == 423 Locked:
+raise Locked()
 elif not result.getvalue():
 # We haven't had any errors yet, so our result is empty
 # and we need to set up the XML header
@@ -530,7 +534,7 @@
 dflag = hasattr(ob,'_p_changed') and (ob._p_changed == None)
 if hasattr(ob, '__dav_resource__'):
 uri = urljoin(url, absattr(ob.getId()))
-self.apply(ob, token, user, uri, result, top=0)
+self.apply(ob, token, sm, uri, result, top=0)
 if dflag:
 ob._p_deactivate()
 if not top:

Modified: Zope/branches/2.13/src/webdav/tests/test_davcmds.py
===
--- Zope/branches/2.13/src/webdav/tests/test_davcmds.py 2010-12-28 12:07:27 UTC 
(rev 119193)
+++ Zope/branches/2.13/src/webdav/tests/test_davcmds.py 2010-12-28 12:14:38 UTC 
(rev 119194)
@@ -1,26 +1,44 @@
 import unittest
 
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.SecurityManagement import newSecurityManager

[Zope-Checkins] SVN: Zope/trunk/src/webdav/ - fixed permission check and error handling in DeleteCollection

2010-12-28 Thread Yvo Schubbe
Log message for revision 119195:
  - fixed permission check and error handling in DeleteCollection

Changed:
  U   Zope/trunk/src/webdav/Collection.py
  U   Zope/trunk/src/webdav/davcmds.py
  U   Zope/trunk/src/webdav/tests/test_davcmds.py

-=-
Modified: Zope/trunk/src/webdav/Collection.py
===
--- Zope/trunk/src/webdav/Collection.py 2010-12-28 12:14:38 UTC (rev 119194)
+++ Zope/trunk/src/webdav/Collection.py 2010-12-28 12:16:02 UTC (rev 119195)
@@ -89,7 +89,7 @@
 url = urlfix(REQUEST['URL'], 'DELETE')
 name = unquote(filter(None, url.split( '/'))[-1])
 parent = self.aq_parent
-user = getSecurityManager().getUser()
+sm = getSecurityManager()
 token = None
 
 #if re.match(/Control_Panel,REQUEST['PATH_INFO']):
@@ -119,7 +119,7 @@
 if ifhdr.find(tok)  -1:
 token = tok
 cmd = DeleteCollection()
-result = cmd.apply(self, token, user, REQUEST['URL'])
+result = cmd.apply(self, token, sm, REQUEST['URL'])
 
 if result:
 # There were conflicts, so we need to report them

Modified: Zope/trunk/src/webdav/davcmds.py
===
--- Zope/trunk/src/webdav/davcmds.py2010-12-28 12:14:38 UTC (rev 119194)
+++ Zope/trunk/src/webdav/davcmds.py2010-12-28 12:16:02 UTC (rev 119195)
@@ -18,6 +18,7 @@
 from urllib import quote
 
 import transaction
+from AccessControl.Permissions import delete_objects
 from AccessControl.SecurityManagement import getSecurityManager
 from Acquisition import aq_base
 from Acquisition import aq_parent
@@ -26,11 +27,12 @@
 from zExceptions import Forbidden
 
 from webdav.common import absattr
+from webdav.common import isDavCollection
+from webdav.common import Locked
+from webdav.common import PreconditionFailed
 from webdav.common import urlbase
 from webdav.common import urlfix
 from webdav.common import urljoin
-from webdav.common import isDavCollection
-from webdav.common import PreconditionFailed
 from webdav.interfaces import IWriteLock
 from webdav.LockItem import LockItem
 from webdav.xmltools import XmlParser
@@ -492,7 +494,7 @@
 checking *all* descendents (deletes on collections are always of depth
 infinite) for locks and if the locks match. 
 
-def apply(self, obj, token, user, url=None, result=None, top=1):
+def apply(self, obj, token, sm, url=None, result=None, top=1):
 if result is None:
 result = StringIO()
 url = urlfix(url, 'DELETE')
@@ -502,7 +504,7 @@
 parent = aq_parent(obj)
 
 islockable = IWriteLock.providedBy(obj)
-if parent and (not user.has_permission('Delete objects', parent)):
+if parent and (not sm.checkPermission(delete_objects, parent)):
 # User doesn't have permission to delete this object
 errmsg = 403 Forbidden
 elif islockable and obj.wl_isLocked():
@@ -514,8 +516,10 @@
 
 if errmsg:
 if top and (not iscol):
-err = errmsg[4:]
-raise err
+if errmsg == 403 Forbidden:
+raise Forbidden()
+if errmsg == 423 Locked:
+raise Locked()
 elif not result.getvalue():
 # We haven't had any errors yet, so our result is empty
 # and we need to set up the XML header
@@ -530,7 +534,7 @@
 dflag = hasattr(ob,'_p_changed') and (ob._p_changed == None)
 if hasattr(ob, '__dav_resource__'):
 uri = urljoin(url, absattr(ob.getId()))
-self.apply(ob, token, user, uri, result, top=0)
+self.apply(ob, token, sm, uri, result, top=0)
 if dflag:
 ob._p_deactivate()
 if not top:

Modified: Zope/trunk/src/webdav/tests/test_davcmds.py
===
--- Zope/trunk/src/webdav/tests/test_davcmds.py 2010-12-28 12:14:38 UTC (rev 
119194)
+++ Zope/trunk/src/webdav/tests/test_davcmds.py 2010-12-28 12:16:02 UTC (rev 
119195)
@@ -1,26 +1,44 @@
 import unittest
 
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.SecurityManager import setSecurityPolicy
+from zExceptions import Forbidden
+from zope.interface import implements
+
+
+class _DummySecurityPolicy(object):
+
+def checkPermission(self, permission, object, context):
+return False
+
+
+class _DummyContent(object):
+
+from webdav.interfaces import IWriteLock
+implements(IWriteLock)
+
+def __init__(self, token=None):
+self.token = token
+
+def wl_hasLock(self, token):
+return self.token == token
+
+def wl_isLocked(self):
+

[Zope-Checkins] SVN: Zope/trunk/src/webdav/tests/test_davcmds.py - simplified test setup

2010-12-28 Thread Yvo Schubbe
Log message for revision 119197:
  - simplified test setup

Changed:
  U   Zope/trunk/src/webdav/tests/test_davcmds.py

-=-
Modified: Zope/trunk/src/webdav/tests/test_davcmds.py
===
--- Zope/trunk/src/webdav/tests/test_davcmds.py 2010-12-28 13:51:01 UTC (rev 
119196)
+++ Zope/trunk/src/webdav/tests/test_davcmds.py 2010-12-28 13:51:27 UTC (rev 
119197)
@@ -1,7 +1,6 @@
 import unittest
 
 from AccessControl.SecurityManagement import getSecurityManager
-from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
 from AccessControl.SecurityManager import setSecurityPolicy
 from zExceptions import Forbidden
@@ -111,7 +110,6 @@
 
 def setUp(self):
 self._oldPolicy = setSecurityPolicy(_DummySecurityPolicy())
-newSecurityManager(None, object())
 
 def tearDown(self):
 noSecurityManager()

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


[Zope-Checkins] SVN: Zope/branches/2.13/ - fixed permission check in ObjectManager

2010-12-28 Thread Yvo Schubbe
Log message for revision 119198:
  - fixed permission check in ObjectManager

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/OFS/ObjectManager.py
  UU  Zope/branches/2.13/src/OFS/tests/testObjectManager.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2010-12-28 13:51:27 UTC (rev 119197)
+++ Zope/branches/2.13/doc/CHANGES.rst  2010-12-28 13:57:19 UTC (rev 119198)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++
 
+- OFS: Fixed permission check in ObjectManager.
+
 - webdav: Fixed permission check and error handling in DeleteCollection.
 
 - LP 686664: WebDAV Lock Manager ZMI view wasn't accessible.

Modified: Zope/branches/2.13/src/OFS/ObjectManager.py
===
--- Zope/branches/2.13/src/OFS/ObjectManager.py 2010-12-28 13:51:27 UTC (rev 
119197)
+++ Zope/branches/2.13/src/OFS/ObjectManager.py 2010-12-28 13:57:19 UTC (rev 
119198)
@@ -266,15 +266,15 @@
 def filtered_meta_types(self, user=None):
 # Return a list of the types for which the user has
 # adequate permission to add that type of object.
-user=getSecurityManager().getUser()
-meta_types=[]
+sm = getSecurityManager()
+meta_types = []
 if callable(self.all_meta_types):
-all=self.all_meta_types()
+all = self.all_meta_types()
 else:
-all=self.all_meta_types
+all = self.all_meta_types
 for meta_type in all:
 if meta_type.has_key('permission'):
-if user.has_permission(meta_type['permission'],self):
+if sm.checkPermission(meta_type['permission'], self):
 meta_types.append(meta_type)
 else:
 meta_types.append(meta_type)


Property changes on: Zope/branches/2.13/src/OFS/ObjectManager.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/branches/2.13/src/OFS/tests/testObjectManager.py
===
--- Zope/branches/2.13/src/OFS/tests/testObjectManager.py   2010-12-28 
13:51:27 UTC (rev 119197)
+++ Zope/branches/2.13/src/OFS/tests/testObjectManager.py   2010-12-28 
13:57:19 UTC (rev 119198)
@@ -1,23 +1,24 @@
 import unittest
 
-from zope.component.testing import PlacelessSetup
-from zope.interface import implements
-
 from AccessControl.owner import EmergencyUserCannotOwn
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.SecurityManager import setSecurityPolicy
+from AccessControl.SpecialUsers import emergency_user, nobody, system
 from AccessControl.User import User # before SpecialUsers
-from AccessControl.SpecialUsers import emergency_user, nobody, system
 from Acquisition import aq_base
 from Acquisition import Implicit
 from App.config import getConfiguration
 from logging import getLogger
+from zExceptions import BadRequest
+from zope.component.testing import PlacelessSetup
+from zope.interface import implements
+from Zope2.App import zcml
+
 from OFS.interfaces import IItem
 from OFS.metaconfigure import setDeprecatedManageAddDelete
 from OFS.ObjectManager import ObjectManager
 from OFS.SimpleItem import SimpleItem
-from Zope2.App import zcml
-from zExceptions import BadRequest
 
 logger = getLogger('OFS.subscribers')
 
@@ -103,6 +104,26 @@
 verifyClass(IContainer, ObjectManager)
 verifyClass(IObjectManager, ObjectManager)
 
+def test_filtered_meta_types(self):
+
+class _DummySecurityPolicy(object):
+
+def checkPermission(self, permission, object, context):
+return permission == 'addFoo'
+
+om = self._makeOne()
+om.all_meta_types = ({'name': 'Foo', 'permission': 'addFoo'},
+ {'name': 'Bar', 'permission': 'addBar'},
+ {'name': 'Baz'})
+try:
+oldPolicy = setSecurityPolicy(_DummySecurityPolicy())
+self.assertEqual(len(om.filtered_meta_types()), 2)
+self.assertEqual(om.filtered_meta_types()[0]['name'], 'Foo')
+self.assertEqual(om.filtered_meta_types()[1]['name'], 'Baz')
+finally:
+noSecurityManager()
+setSecurityPolicy(oldPolicy)
+
 def test_setObject_set_owner_with_no_user( self ):
 om = self._makeOne()
 newSecurityManager( None, None )


Property changes on: Zope/branches/2.13/src/OFS/tests/testObjectManager.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/trunk/src/OFS/ - fixed permission check in ObjectManager

2010-12-28 Thread Yvo Schubbe
Log message for revision 119199:
  - fixed permission check in ObjectManager

Changed:
  UU  Zope/trunk/src/OFS/ObjectManager.py
  UU  Zope/trunk/src/OFS/tests/testObjectManager.py

-=-
Modified: Zope/trunk/src/OFS/ObjectManager.py
===
--- Zope/trunk/src/OFS/ObjectManager.py 2010-12-28 13:57:19 UTC (rev 119198)
+++ Zope/trunk/src/OFS/ObjectManager.py 2010-12-28 13:57:36 UTC (rev 119199)
@@ -266,15 +266,15 @@
 def filtered_meta_types(self, user=None):
 # Return a list of the types for which the user has
 # adequate permission to add that type of object.
-user=getSecurityManager().getUser()
-meta_types=[]
+sm = getSecurityManager()
+meta_types = []
 if callable(self.all_meta_types):
-all=self.all_meta_types()
+all = self.all_meta_types()
 else:
-all=self.all_meta_types
+all = self.all_meta_types
 for meta_type in all:
 if meta_type.has_key('permission'):
-if user.has_permission(meta_type['permission'],self):
+if sm.checkPermission(meta_type['permission'], self):
 meta_types.append(meta_type)
 else:
 meta_types.append(meta_type)


Property changes on: Zope/trunk/src/OFS/ObjectManager.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/OFS/tests/testObjectManager.py
===
--- Zope/trunk/src/OFS/tests/testObjectManager.py   2010-12-28 13:57:19 UTC 
(rev 119198)
+++ Zope/trunk/src/OFS/tests/testObjectManager.py   2010-12-28 13:57:36 UTC 
(rev 119199)
@@ -1,23 +1,24 @@
 import unittest
 
-from zope.component.testing import PlacelessSetup
-from zope.interface import implements
-
 from AccessControl.owner import EmergencyUserCannotOwn
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.SecurityManager import setSecurityPolicy
+from AccessControl.SpecialUsers import emergency_user, nobody, system
 from AccessControl.User import User # before SpecialUsers
-from AccessControl.SpecialUsers import emergency_user, nobody, system
 from Acquisition import aq_base
 from Acquisition import Implicit
 from App.config import getConfiguration
 from logging import getLogger
+from zExceptions import BadRequest
+from zope.component.testing import PlacelessSetup
+from zope.interface import implements
+from Zope2.App import zcml
+
 from OFS.interfaces import IItem
 from OFS.metaconfigure import setDeprecatedManageAddDelete
 from OFS.ObjectManager import ObjectManager
 from OFS.SimpleItem import SimpleItem
-from Zope2.App import zcml
-from zExceptions import BadRequest
 
 logger = getLogger('OFS.subscribers')
 
@@ -103,6 +104,26 @@
 verifyClass(IContainer, ObjectManager)
 verifyClass(IObjectManager, ObjectManager)
 
+def test_filtered_meta_types(self):
+
+class _DummySecurityPolicy(object):
+
+def checkPermission(self, permission, object, context):
+return permission == 'addFoo'
+
+om = self._makeOne()
+om.all_meta_types = ({'name': 'Foo', 'permission': 'addFoo'},
+ {'name': 'Bar', 'permission': 'addBar'},
+ {'name': 'Baz'})
+try:
+oldPolicy = setSecurityPolicy(_DummySecurityPolicy())
+self.assertEqual(len(om.filtered_meta_types()), 2)
+self.assertEqual(om.filtered_meta_types()[0]['name'], 'Foo')
+self.assertEqual(om.filtered_meta_types()[1]['name'], 'Baz')
+finally:
+noSecurityManager()
+setSecurityPolicy(oldPolicy)
+
 def test_setObject_set_owner_with_no_user( self ):
 om = self._makeOne()
 newSecurityManager( None, None )


Property changes on: Zope/trunk/src/OFS/tests/testObjectManager.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/branches/2.13/ - fixed some permission checks

2010-12-28 Thread Yvo Schubbe
Log message for revision 119201:
  - fixed some permission checks

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/HelpSys/HelpSys.py
  UU  Zope/branches/2.13/src/HelpSys/HelpTopic.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2010-12-28 15:16:52 UTC (rev 119200)
+++ Zope/branches/2.13/doc/CHANGES.rst  2010-12-28 17:10:19 UTC (rev 119201)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++
 
+- HelpSys: Fixed some permission checks.
+
 - OFS: Fixed permission check in ObjectManager.
 
 - webdav: Fixed permission check and error handling in DeleteCollection.

Modified: Zope/branches/2.13/src/HelpSys/HelpSys.py
===
--- Zope/branches/2.13/src/HelpSys/HelpSys.py   2010-12-28 15:16:52 UTC (rev 
119200)
+++ Zope/branches/2.13/src/HelpSys/HelpSys.py   2010-12-28 17:10:19 UTC (rev 
119201)
@@ -17,6 +17,7 @@
 from AccessControl.Permissions import add_documents_images_and_files
 from AccessControl.Permissions import view as View
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
 from Acquisition import Implicit
 from App.special_dtml import DTMLFile
 from App.special_dtml import HTML
@@ -24,12 +25,12 @@
 from OFS.SimpleItem import Item
 from Persistence import Persistent
 from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
-from Products.ZCatalog.ZCatalog import ZCatalog
 from Products.ZCatalog.Lazy import LazyCat
-from Products.ZCTextIndex.OkapiIndex import OkapiIndex
-from Products.ZCTextIndex.Lexicon import CaseNormalizer
+from Products.ZCatalog.ZCatalog import ZCatalog
 from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter
+from Products.ZCTextIndex.Lexicon import CaseNormalizer
 from Products.ZCTextIndex.Lexicon import StopWordRemover
+from Products.ZCTextIndex.OkapiIndex import OkapiIndex
 from Products.ZCTextIndex.ZCTextIndex import PLexicon
 from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
 
@@ -72,13 +73,13 @@
 def __call__(self, REQUEST=None, **kw):
 Searchable interface
 if REQUEST is not None:
-perms=[]
-user=REQUEST.AUTHENTICATED_USER
-for p in self.ac_inherited_permissions():
-if user.has_permission(p[0], self):
+perms = []
+sm = getSecurityManager()
+for p in self.ac_inherited_permissions(all=True):
+if sm.checkPermission(p[0], self):
 perms.append(p[0])
-REQUEST.set('permissions',perms)
-results=[]
+REQUEST.set('permissions', perms)
+results = []
 for ph in self.helpValues():
 results.append(apply(getattr(ph, '__call__'), (REQUEST,) , kw))
 return LazyCat(results)
@@ -268,11 +269,9 @@
 Help Topics for which the user is not authorized
 are not listed.
 
-topics=self.objectValues('Help Topic')
-if REQUEST is None:
-return topics
-return filter(
-lambda ht, u=REQUEST.AUTHENTICATED_USER: ht.authorized(u), topics)
+topics = self.objectValues('Help Topic')
+sm = getSecurityManager()
+return [ t for t in topics if t.authorized(sm) ]
 
 def tpValues(self):
 


Property changes on: Zope/branches/2.13/src/HelpSys/HelpSys.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/branches/2.13/src/HelpSys/HelpTopic.py
===
--- Zope/branches/2.13/src/HelpSys/HelpTopic.py 2010-12-28 15:16:52 UTC (rev 
119200)
+++ Zope/branches/2.13/src/HelpSys/HelpTopic.py 2010-12-28 17:10:19 UTC (rev 
119201)
@@ -58,14 +58,11 @@
 def helpValues(self, REQUEST=None):
 return ()
 
-def authorized(self, user):
+def authorized(self, sm):
 Is a given user authorized to view this Help Topic?
 if not self.permissions:
-return 1
-for perm in self.permissions:
-if user.has_permission(perm, self):
-return 1
-return 0
+return True
+return any( sm.checkPermission(p, self) for p in self.permissions )
 
 # Indexable methods
 # -


Property changes on: Zope/branches/2.13/src/HelpSys/HelpTopic.py
___
Deleted: cvs2svn:cvs-rev
   - 1.19

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


[Zope-Checkins] SVN: Zope/trunk/src/HelpSys/Help - fixed some permission checks

2010-12-28 Thread Yvo Schubbe
Log message for revision 119202:
  - fixed some permission checks

Changed:
  UU  Zope/trunk/src/HelpSys/HelpSys.py
  UU  Zope/trunk/src/HelpSys/HelpTopic.py

-=-
Modified: Zope/trunk/src/HelpSys/HelpSys.py
===
--- Zope/trunk/src/HelpSys/HelpSys.py   2010-12-28 17:10:19 UTC (rev 119201)
+++ Zope/trunk/src/HelpSys/HelpSys.py   2010-12-28 17:10:33 UTC (rev 119202)
@@ -17,6 +17,7 @@
 from AccessControl.Permissions import add_documents_images_and_files
 from AccessControl.Permissions import view as View
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
 from Acquisition import Implicit
 from App.special_dtml import DTMLFile
 from App.special_dtml import HTML
@@ -24,12 +25,12 @@
 from OFS.SimpleItem import Item
 from Persistence import Persistent
 from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
-from Products.ZCatalog.ZCatalog import ZCatalog
 from Products.ZCatalog.Lazy import LazyCat
-from Products.ZCTextIndex.OkapiIndex import OkapiIndex
-from Products.ZCTextIndex.Lexicon import CaseNormalizer
+from Products.ZCatalog.ZCatalog import ZCatalog
 from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter
+from Products.ZCTextIndex.Lexicon import CaseNormalizer
 from Products.ZCTextIndex.Lexicon import StopWordRemover
+from Products.ZCTextIndex.OkapiIndex import OkapiIndex
 from Products.ZCTextIndex.ZCTextIndex import PLexicon
 from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
 
@@ -72,13 +73,13 @@
 def __call__(self, REQUEST=None, **kw):
 Searchable interface
 if REQUEST is not None:
-perms=[]
-user=REQUEST.AUTHENTICATED_USER
-for p in self.ac_inherited_permissions():
-if user.has_permission(p[0], self):
+perms = []
+sm = getSecurityManager()
+for p in self.ac_inherited_permissions(all=True):
+if sm.checkPermission(p[0], self):
 perms.append(p[0])
-REQUEST.set('permissions',perms)
-results=[]
+REQUEST.set('permissions', perms)
+results = []
 for ph in self.helpValues():
 results.append(apply(getattr(ph, '__call__'), (REQUEST,) , kw))
 return LazyCat(results)
@@ -268,11 +269,9 @@
 Help Topics for which the user is not authorized
 are not listed.
 
-topics=self.objectValues('Help Topic')
-if REQUEST is None:
-return topics
-return filter(
-lambda ht, u=REQUEST.AUTHENTICATED_USER: ht.authorized(u), topics)
+topics = self.objectValues('Help Topic')
+sm = getSecurityManager()
+return [ t for t in topics if t.authorized(sm) ]
 
 def tpValues(self):
 


Property changes on: Zope/trunk/src/HelpSys/HelpSys.py
___
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/HelpSys/HelpTopic.py
===
--- Zope/trunk/src/HelpSys/HelpTopic.py 2010-12-28 17:10:19 UTC (rev 119201)
+++ Zope/trunk/src/HelpSys/HelpTopic.py 2010-12-28 17:10:33 UTC (rev 119202)
@@ -58,14 +58,11 @@
 def helpValues(self, REQUEST=None):
 return ()
 
-def authorized(self, user):
+def authorized(self, sm):
 Is a given user authorized to view this Help Topic?
 if not self.permissions:
-return 1
-for perm in self.permissions:
-if user.has_permission(perm, self):
-return 1
-return 0
+return True
+return any( sm.checkPermission(p, self) for p in self.permissions )
 
 # Indexable methods
 # -


Property changes on: Zope/trunk/src/HelpSys/HelpTopic.py
___
Deleted: cvs2svn:cvs-rev
   - 1.19

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


[Zope-Checkins] SVN: Zope/trunk/src/OFS/userfolder.py - doesn't make a difference here, but the right API method for getting the user ID is getId, not getUserName

2010-12-27 Thread Yvo Schubbe
Log message for revision 119159:
  - doesn't make a difference here, but the right API method for getting the 
user ID is getId, not getUserName

Changed:
  U   Zope/trunk/src/OFS/userfolder.py

-=-
Modified: Zope/trunk/src/OFS/userfolder.py
===
--- Zope/trunk/src/OFS/userfolder.py2010-12-27 11:04:11 UTC (rev 119158)
+++ Zope/trunk/src/OFS/userfolder.py2010-12-27 11:08:37 UTC (rev 119159)
@@ -122,7 +122,7 @@
 pw = u._getPassword()
 if not self._isPasswordEncrypted(pw):
 pw = self._encryptPassword(pw)
-self._doChangeUser(u.getUserName(), pw, u.getRoles(),
+self._doChangeUser(u.getId(), pw, u.getRoles(),
u.getDomains())
 changed = changed + 1
 if REQUEST is not None:

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


[Zope-Checkins] SVN: Zope/trunk/ - fixed two unit tests that failed on fast Windows machines

2010-09-26 Thread Yvo Schubbe
Log message for revision 116951:
  - fixed two unit tests that failed on fast Windows machines

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/OFS/tests/testHistory.py
  U   Zope/trunk/src/Products/ZCatalog/tests/test_plan.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2010-09-25 22:12:57 UTC (rev 116950)
+++ Zope/trunk/doc/CHANGES.rst  2010-09-26 09:34:29 UTC (rev 116951)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++
 
+- Fixed two unit tests that failed on fast Windows machines.
+
 - Fixed ``testZODBCompat`` tests in ZopeTestCase to match modern ZODB
   semantics.
 

Modified: Zope/trunk/src/OFS/tests/testHistory.py
===
--- Zope/trunk/src/OFS/tests/testHistory.py 2010-09-25 22:12:57 UTC (rev 
116950)
+++ Zope/trunk/src/OFS/tests/testHistory.py 2010-09-26 09:34:29 UTC (rev 
116951)
@@ -4,11 +4,11 @@
 
 import os
 import shutil
+import time
 import transaction
 import tempfile
 import ZODB
 
-
 from OFS.Application import Application
 from OFS.History import Historical
 from OFS.SimpleItem import SimpleItem
@@ -42,10 +42,12 @@
 t.description = None
 t.note('Change 1')
 t.commit()
+time.sleep(0.02) # wait at least one Windows clock tick
 hi.title = 'Second title'
 t = transaction.get()
 t.note('Change 2')
 t.commit()
+time.sleep(0.02) # wait at least one Windows clock tick
 hi.title = 'Third title'
 t = transaction.get()
 t.note('Change 3')

Modified: Zope/trunk/src/Products/ZCatalog/tests/test_plan.py
===
--- Zope/trunk/src/Products/ZCatalog/tests/test_plan.py 2010-09-25 22:12:57 UTC 
(rev 116950)
+++ Zope/trunk/src/Products/ZCatalog/tests/test_plan.py 2010-09-26 09:34:29 UTC 
(rev 116951)
@@ -255,6 +255,7 @@
 plan.stop_split('index1')
 plan.start_split('sort_on')
 plan.stop_split('sort_on')
+time.sleep(0.02) # wait at least one Windows clock tick
 plan.stop()
 
 self.assert_(plan.duration  0)

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


[Zope-Checkins] SVN: Zope/branches/2.12/ - updated zc.buildout version

2010-09-20 Thread Yvo Schubbe
Log message for revision 116658:
  - updated zc.buildout version

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/versions.cfg

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-09-20 08:20:56 UTC (rev 116657)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-09-20 10:37:25 UTC (rev 116658)
@@ -19,6 +19,7 @@
 - Updated packages:
 
   - lxml = 2.2.8
+  - zc.buildout = 1.4.4
 
 2.12.11 (2010-09-09)
 

Modified: Zope/branches/2.12/versions.cfg
===
--- Zope/branches/2.12/versions.cfg 2010-09-20 08:20:56 UTC (rev 116657)
+++ Zope/branches/2.12/versions.cfg 2010-09-20 10:37:25 UTC (rev 116658)
@@ -31,7 +31,7 @@
 ThreadLock = 2.13.0
 transaction = 1.0.0
 z3c.checkversions = 0.2
-zc.buildout = 1.4.3
+zc.buildout = 1.4.4
 zc.lockfile = 1.0.0
 zc.recipe.egg = 1.2.2
 zc.recipe.testrunner = 1.2.0

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


[Zope-Checkins] SVN: Zope/branches/2.12/bootstrap.py - made room for a new bootstrap.py copy

2010-09-20 Thread Yvo Schubbe
Log message for revision 116659:
  - made room for a new bootstrap.py copy

Changed:
  D   Zope/branches/2.12/bootstrap.py

-=-
Deleted: Zope/branches/2.12/bootstrap.py
===
--- Zope/branches/2.12/bootstrap.py 2010-09-20 10:37:25 UTC (rev 116658)
+++ Zope/branches/2.12/bootstrap.py 2010-09-20 10:45:29 UTC (rev 116659)
@@ -1,121 +0,0 @@
-##
-#
-# Copyright (c) 2006 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.
-#
-##
-Bootstrap a buildout-based project
-
-Simply run this script in a directory containing a buildout.cfg.
-The script accepts buildout command-line options, so you can
-use the -c option to specify an alternate configuration file.
-
-$Id$
-
-
-import os, shutil, sys, tempfile, urllib2
-from optparse import OptionParser
-
-tmpeggs = tempfile.mkdtemp()
-
-is_jython = sys.platform.startswith('java')
-
-# 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.)
-
-parser.add_option(-c, None, action=store, dest=config_file,
-   help=(Specify the path to the buildout configuration 
- file to be used.))
-
-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 = ''
-
-USE_DISTRIBUTE = options.distribute
-args = args + ['bootstrap']
-
-to_reload = False
-try:
-import pkg_resources
-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)
-
-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()'
-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
-
-ws.add_entry(tmpeggs)
-ws.require('zc.buildout' + VERSION)
-import zc.buildout.buildout
-zc.buildout.buildout.main(args)
-shutil.rmtree(tmpeggs)
\ No newline at end of file

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


[Zope-Checkins] SVN: Zope/trunk/bootstrap.py - made room for a new bootstrap.py copy

2010-09-20 Thread Yvo Schubbe
Log message for revision 116660:
  - made room for a new bootstrap.py copy

Changed:
  D   Zope/trunk/bootstrap.py

-=-
Deleted: Zope/trunk/bootstrap.py
===
--- Zope/trunk/bootstrap.py 2010-09-20 10:45:29 UTC (rev 116659)
+++ Zope/trunk/bootstrap.py 2010-09-20 10:45:46 UTC (rev 116660)
@@ -1,121 +0,0 @@
-##
-#
-# Copyright (c) 2006 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.
-#
-##
-Bootstrap a buildout-based project
-
-Simply run this script in a directory containing a buildout.cfg.
-The script accepts buildout command-line options, so you can
-use the -c option to specify an alternate configuration file.
-
-$Id$
-
-
-import os, shutil, sys, tempfile, urllib2
-from optparse import OptionParser
-
-tmpeggs = tempfile.mkdtemp()
-
-is_jython = sys.platform.startswith('java')
-
-# 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.)
-
-parser.add_option(-c, None, action=store, dest=config_file,
-   help=(Specify the path to the buildout configuration 
- file to be used.))
-
-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 = ''
-
-USE_DISTRIBUTE = options.distribute
-args = args + ['bootstrap']
-
-to_reload = False
-try:
-import pkg_resources
-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)
-
-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()'
-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
-
-ws.add_entry(tmpeggs)
-ws.require('zc.buildout' + VERSION)
-import zc.buildout.buildout
-zc.buildout.buildout.main(args)
-shutil.rmtree(tmpeggs)

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


[Zope-Checkins] SVN: Zope/trunk/bootstrap.py - added a local copy of the special 1.4.4 bootstrap.py

2010-09-20 Thread Yvo Schubbe
Log message for revision 116661:
  - added a local copy of the special 1.4.4 bootstrap.py

Changed:
  A   Zope/trunk/bootstrap.py

-=-
Copied: Zope/trunk/bootstrap.py (from rev 116609, 
zc.buildout/tags/1.4.4/bootstrap/bootstrap.py)
===
--- Zope/trunk/bootstrap.py (rev 0)
+++ Zope/trunk/bootstrap.py 2010-09-20 10:49:30 UTC (rev 116661)
@@ -0,0 +1,127 @@
+##
+#
+# Copyright (c) 2006 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.
+#
+##
+Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 115394 2010-08-03 00:03:02Z gary $
+
+
+import os, shutil, sys, tempfile, urllib2
+from optparse import OptionParser
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+# parsing arguments
+parser = OptionParser(
+'This is a custom version of the zc.buildout %prog script.  It is '
+'intended to meet a temporary need if you encounter problems with '
+'the zc.buildout 1.5 release.')
+parser.add_option(-v, --version, dest=version, default='1.4.4',
+  help='Use a specific zc.buildout version.  *This '
+  'bootstrap script defaults to '
+  '1.4.4, unlike usual buildpout bootstrap scripts.*')
+parser.add_option(-d, --distribute,
+   action=store_true, dest=distribute, default=False,
+   help=Use Disribute rather than Setuptools.)
+
+parser.add_option(-c, None, action=store, dest=config_file,
+   help=(Specify the path to the buildout configuration 
+ file to be used.))
+
+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 = ''
+
+USE_DISTRIBUTE = options.distribute
+args = args + ['bootstrap']
+
+to_reload = False
+try:
+import pkg_resources
+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)
+
+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
+
+ws  = pkg_resources.working_set
+
+if USE_DISTRIBUTE:
+requirement = 'distribute'
+else:
+requirement = 'setuptools'
+
+env = dict(os.environ,
+   PYTHONPATH=
+   ws.find(pkg_resources.Requirement.parse(requirement)).location
+   )
+
+cmd = [quote(sys.executable),
+   '-c',
+   quote('from setuptools.command.easy_install import main; main()'),
+   '-mqNxd',
+   quote(tmpeggs)]
+
+if 'bootstrap-testing-find-links' in os.environ:
+cmd.extend(['-f', os.environ['bootstrap-testing-find-links']])
+
+cmd.append('zc.buildout' + VERSION)
+
+if is_jython:
+import subprocess
+exitcode = subprocess.Popen(cmd, env=env).wait()
+else: # Windows prefers this, apparently; otherwise we would prefer subprocess
+exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
+assert exitcode == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout' + VERSION)
+import zc.buildout.buildout
+zc.buildout.buildout.main(args)
+shutil.rmtree(tmpeggs)


Property changes on: Zope/trunk/bootstrap.py
___
Added: svn:eol-style
   + native

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org

[Zope-Checkins] SVN: Zope/trunk/ - fixed copyright header

2010-09-20 Thread Yvo Schubbe
Log message for revision 116663:
  - fixed copyright header

Changed:
  U   Zope/trunk/bootstrap.py
  UU  Zope/trunk/src/Products/ZCatalog/tests/test_plan.py

-=-
Modified: Zope/trunk/bootstrap.py
===
--- Zope/trunk/bootstrap.py 2010-09-20 10:49:53 UTC (rev 116662)
+++ Zope/trunk/bootstrap.py 2010-09-20 11:11:10 UTC (rev 116663)
@@ -1,6 +1,6 @@
 ##
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/trunk/src/Products/ZCatalog/tests/test_plan.py
===
--- Zope/trunk/src/Products/ZCatalog/tests/test_plan.py 2010-09-20 10:49:53 UTC 
(rev 116662)
+++ Zope/trunk/src/Products/ZCatalog/tests/test_plan.py 2010-09-20 11:11:10 UTC 
(rev 116663)
@@ -1,6 +1,6 @@
 ##
 #
-# Copyright (c) 2010 Zope Foundation and Contributors. All Rights Reserved.
+# Copyright (c) 2010 Zope Foundation and Contributors.
 #
 # 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.


Property changes on: Zope/trunk/src/Products/ZCatalog/tests/test_plan.py
___
Deleted: svn:keywords
   - Id

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


[Zope-Checkins] SVN: Zope/branches/2.12/bootstrap.py - fixed copyright header

2010-09-20 Thread Yvo Schubbe
Log message for revision 116664:
  - fixed copyright header

Changed:
  U   Zope/branches/2.12/bootstrap.py

-=-
Modified: Zope/branches/2.12/bootstrap.py
===
--- Zope/branches/2.12/bootstrap.py 2010-09-20 11:11:10 UTC (rev 116663)
+++ Zope/branches/2.12/bootstrap.py 2010-09-20 11:11:30 UTC (rev 116664)
@@ -1,6 +1,6 @@
 ##
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

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


[Zope-Checkins] SVN: Zope/trunk/versions.cfg - switched to latest ztk release

2010-09-17 Thread Yvo Schubbe
Log message for revision 116527:
  - switched to latest ztk release

Changed:
  U   Zope/trunk/versions.cfg

-=-
Modified: Zope/trunk/versions.cfg
===
--- Zope/trunk/versions.cfg 2010-09-17 13:13:48 UTC (rev 116526)
+++ Zope/trunk/versions.cfg 2010-09-17 13:24:01 UTC (rev 116527)
@@ -1,5 +1,5 @@
 [buildout]
-extends = http://download.zope.org/zopetoolkit/index/1.0a3/ztk-versions.cfg
+extends = http://download.zope.org/zopetoolkit/index/1.0c1/ztk-versions.cfg
 versions = versions
 
 [versions]

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


[Zope-Checkins] SVN: Zope/branches/2.12/buildout.cfg - 'scripts' is the default recipe

2010-08-06 Thread Yvo Schubbe
Log message for revision 115518:
  - 'scripts' is the default recipe

Changed:
  U   Zope/branches/2.12/buildout.cfg

-=-
Modified: Zope/branches/2.12/buildout.cfg
===
--- Zope/branches/2.12/buildout.cfg 2010-08-06 09:03:40 UTC (rev 115517)
+++ Zope/branches/2.12/buildout.cfg 2010-08-06 10:11:10 UTC (rev 115518)
@@ -21,7 +21,7 @@
 
 
 [scripts]
-recipe = zc.recipe.egg:scripts
+recipe = zc.recipe.egg
 eggs = Zope2
 
 

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


[Zope-Checkins] SVN: Zope/trunk/buildout.cfg - 'scripts' is the default recipe

2010-08-06 Thread Yvo Schubbe
Log message for revision 115519:
  - 'scripts' is the default recipe

Changed:
  U   Zope/trunk/buildout.cfg

-=-
Modified: Zope/trunk/buildout.cfg
===
--- Zope/trunk/buildout.cfg 2010-08-06 10:11:10 UTC (rev 115518)
+++ Zope/trunk/buildout.cfg 2010-08-06 10:11:36 UTC (rev 115519)
@@ -26,7 +26,7 @@
 
 
 [scripts]
-recipe = zc.recipe.egg:scripts
+recipe = zc.recipe.egg
 eggs = Zope2
 
 

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


[Zope-Checkins] SVN: Zope/trunk/src/OFS/metaconfigure.py - added comment (warn against usage in unit tests)

2010-08-01 Thread Yvo Schubbe
Log message for revision 115312:
  - added comment (warn against usage in unit tests)

Changed:
  U   Zope/trunk/src/OFS/metaconfigure.py

-=-
Modified: Zope/trunk/src/OFS/metaconfigure.py
===
--- Zope/trunk/src/OFS/metaconfigure.py 2010-08-01 10:40:51 UTC (rev 115311)
+++ Zope/trunk/src/OFS/metaconfigure.py 2010-08-01 10:46:30 UTC (rev 115312)
@@ -20,6 +20,8 @@
 
 
 def findProducts():
+# Warning: This function only works reliable if called *after* running
+# OFS.Application.import_products. ZopeLite tests disable import_products.
 from types import ModuleType
 products = []
 for name in dir(Products):

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


[Zope-Checkins] SVN: Zope/trunk/src/ - removed obsolete upgradeException calls (there are no string exceptions in Python 2.6)

2010-07-27 Thread Yvo Schubbe
Log message for revision 115118:
  - removed obsolete upgradeException calls (there are no string exceptions in 
Python 2.6)
  - no need to re-raise Redirect in raise_standardErrorMessage 
(ZPublisherExceptionHook is responsible for that)

Changed:
  U   Zope/trunk/src/OFS/SimpleItem.py
  U   Zope/trunk/src/Zope2/App/startup.py

-=-
Modified: Zope/trunk/src/OFS/SimpleItem.py
===
--- Zope/trunk/src/OFS/SimpleItem.py2010-07-27 11:13:40 UTC (rev 115117)
+++ Zope/trunk/src/OFS/SimpleItem.py2010-07-27 11:21:02 UTC (rev 115118)
@@ -48,7 +48,6 @@
 from Persistence import Persistent
 from webdav.Resource import Resource
 from zExceptions import Redirect
-from zExceptions import upgradeException
 from zExceptions.ExceptionFormatter import format_exception
 from zope.interface import implements
 
@@ -197,25 +196,15 @@
 elif type(tb) is type('') and not error_tb:
 error_tb = tb
 
-# warn if error_type is a string
-error_name = 'Unknown'
-if isinstance(error_type, basestring):
-# String Exceptions are deprecated on Python 2.5 and
-# plain won't work at all on Python 2.6. So try to upgrade it
-# to a real exception.
-error_name = error_type
-error_type, error_value = upgradeException(error_type, 
error_value)
-else:
-if hasattr(error_type, '__name__'):
-error_name = error_type.__name__
-
 if hasattr(self, '_v_eek'):
 # Stop if there is recursion.
 raise error_type, error_value, tb
 self._v_eek = 1
 
-if error_name.lower() in ('redirect',):
-raise error_type, error_value, tb
+if hasattr(error_type, '__name__'):
+error_name = error_type.__name__
+else:
+error_name = 'Unknown'
 
 if not error_message:
 try:

Modified: Zope/trunk/src/Zope2/App/startup.py
===
--- Zope/trunk/src/Zope2/App/startup.py 2010-07-27 11:13:40 UTC (rev 115117)
+++ Zope/trunk/src/Zope2/App/startup.py 2010-07-27 11:21:02 UTC (rev 115118)
@@ -27,7 +27,6 @@
 from Acquisition.interfaces import IAcquirer
 from App.config import getConfiguration
 from time import asctime
-from zExceptions import upgradeException
 from zExceptions import Redirect
 from zExceptions import Unauthorized
 from ZODB.POSException import ConflictError
@@ -181,8 +180,6 @@
 
 def __call__(self, published, REQUEST, t, v, traceback):
 try:
-t, v = upgradeException(t, v)
-
 if t is SystemExit or issubclass(t, Redirect):
 raise t, v, traceback
 

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py - added at least one unit test for the 'exception' method

2010-06-22 Thread Yvo Schubbe
Log message for revision 113760:
  - added at least one unit test for the 'exception' method

Changed:
  U   Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py
===
--- Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py 2010-06-22 13:11:14 UTC 
(rev 113759)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py 2010-06-22 13:28:57 UTC 
(rev 113760)
@@ -1,7 +1,9 @@
 # -*- coding: iso-8859-15 -*-
 
 import unittest
+import sys
 
+
 class HTTPResponseTests(unittest.TestCase):
 
 _old_default_encoding = None
@@ -25,7 +27,6 @@
 return self._getTargetClass()(*args, **kw)
 
 def test_ctor_defaults(self):
-import sys
 response = self._makeOne()
 self.assertEqual(response.accumulated_headers, [])
 self.assertEqual(response.status, 200)
@@ -1279,6 +1280,23 @@
 self.assertEqual(len(lines), 1)
 self.assertEqual(lines[0], 'Kilroy was here!')
 
+def test_exception_Internal_Server_Error(self):
+response = self._makeOne()
+try:
+raise AttributeError('ERROR VALUE')
+except AttributeError:
+body = response.exception()
+self.failUnless('ERROR VALUE' in str(body))
+self.assertEqual(response.status, 500)
+self.assertEqual(response.errmsg, 'Internal Server Error')
+# required by Bobo Call Interface (BCI)
+self.assertEqual(response.headers['bobo-exception-type'],
+ type 'exceptions.AttributeError')
+self.assertEqual(response.headers['bobo-exception-value'],
+ 'See the server error log for details')
+self.failUnless('bobo-exception-file' in response.headers)
+self.failUnless('bobo-exception-line' in response.headers)
+
 #TODO
 # def test_exception_* WAA!
 

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/ - small refactoring for better readability: moved some code in separate _setBCIHeaders method

2010-06-22 Thread Yvo Schubbe
Log message for revision 113761:
  - small refactoring for better readability: moved some code in separate 
_setBCIHeaders method

Changed:
  U   Zope/trunk/src/ZPublisher/HTTPResponse.py
  U   Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/trunk/src/ZPublisher/HTTPResponse.py
===
--- Zope/trunk/src/ZPublisher/HTTPResponse.py   2010-06-22 13:28:57 UTC (rev 
113760)
+++ Zope/trunk/src/ZPublisher/HTTPResponse.py   2010-06-22 13:39:12 UTC (rev 
113761)
@@ -755,21 +755,7 @@
 m = m + 'p\nNo Authorization header found./p'
 raise Unauthorized, m
 
-def exception(self, fatal=0, info=None,
-  absuri_match=re.compile(r'\w+://[\w\.]+').match,
-  tag_search=re.compile('[a-zA-Z]').search,
-  abort=1
-  ):
-if isinstance(info, tuple) and len(info) == 3:
-t, v, tb = info
-else:
-t, v, tb = sys.exc_info()
-
-if issubclass(t, Unauthorized):
-self._unauthorized()
-
-stb = tb # note alias between tb and stb
-
+def _setBCIHeaders(self, t, tb):
 try:
 # Try to capture exception info for bci calls
 et = translate(str(t), nl2sp)
@@ -794,13 +780,26 @@
 
 self.setHeader('bobo-exception-file', ef)
 self.setHeader('bobo-exception-line', el)
-
 except:
-# Dont try so hard that we cause other problems ;)
+# Don't try so hard that we cause other problems ;)
 pass
 
-tb = stb # original traceback
-del stb
+del tb
+
+def exception(self, fatal=0, info=None,
+  absuri_match=re.compile(r'\w+://[\w\.]+').match,
+  tag_search=re.compile('[a-zA-Z]').search,
+  abort=1
+  ):
+if isinstance(info, tuple) and len(info) == 3:
+t, v, tb = info
+else:
+t, v, tb = sys.exc_info()
+
+if issubclass(t, Unauthorized):
+self._unauthorized()
+
+self._setBCIHeaders(t, tb)
 self.setStatus(t)
 if self.status = 300 and self.status  400:
 if isinstance(v, str) and absuri_match(v) is not None:

Modified: Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py
===
--- Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py 2010-06-22 13:28:57 UTC 
(rev 113760)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py 2010-06-22 13:39:12 UTC 
(rev 113761)
@@ -1280,6 +1280,23 @@
 self.assertEqual(len(lines), 1)
 self.assertEqual(lines[0], 'Kilroy was here!')
 
+def test__setBCIHeaders(self):
+response = self._makeOne()
+try:
+raise AttributeError('ERROR VALUE')
+except AttributeError:
+t, v, tb = sys.exc_info()
+response._setBCIHeaders(t, tb)
+# required by Bobo Call Interface (BCI)
+self.assertEqual(response.headers['bobo-exception-type'],
+ type 'exceptions.AttributeError')
+self.assertEqual(response.headers['bobo-exception-value'],
+ 'See the server error log for details')
+self.failUnless('bobo-exception-file' in response.headers)
+self.failUnless('bobo-exception-line' in response.headers)
+finally:
+del tb
+
 def test_exception_Internal_Server_Error(self):
 response = self._makeOne()
 try:

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


[Zope-Checkins] SVN: Zope/trunk/ - removed 'Main' and 'Zope' wrappers for Test.publish

2010-06-22 Thread Yvo Schubbe
Log message for revision 113762:
  - removed 'Main' and 'Zope' wrappers for Test.publish

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/ZPublisher/__init__.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2010-06-22 13:39:12 UTC (rev 113761)
+++ Zope/trunk/doc/CHANGES.rst  2010-06-22 13:54:17 UTC (rev 113762)
@@ -11,6 +11,10 @@
 Restructuring
 +
 
+- ZPublisher: Removed 'Main' and 'Zope' wrappers for Test.publish.
+  If anybody really used them, he can easily use ZPublisher.test instead. In
+  the long run ZPublisher.test and ZPublisher.Test might also be removed.
+
 - Moved AccessControl, DocumentTemplate (incl. TreeDisplay) and
   Products.ZCTextIndex to their own distributions. This removes the last
   direct C extensions from the Zope2 distribution.

Modified: Zope/trunk/src/ZPublisher/__init__.py
===
--- Zope/trunk/src/ZPublisher/__init__.py   2010-06-22 13:39:12 UTC (rev 
113761)
+++ Zope/trunk/src/ZPublisher/__init__.py   2010-06-22 13:54:17 UTC (rev 
113762)
@@ -28,16 +28,3 @@
 import Test
 test=Test.publish
 return apply(test, args, kw)
-
-def Main(*args, **kw):
-global test
-import Test
-test=Test.publish
-return apply(test, ('Main',)+args, kw)
-
-# What can we say. ;/
-def Zope(*args, **kw):
-global test
-import Test
-test=Test.publish
-return apply(test, ('Zope',)+args, kw)

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


[Zope-Checkins] SVN: Zope/trunk/src/OFS/interfaces.py - IContainmentRoot is now IRoot

2010-06-18 Thread Yvo Schubbe
Log message for revision 113612:
  - IContainmentRoot is now IRoot

Changed:
  U   Zope/trunk/src/OFS/interfaces.py

-=-
Modified: Zope/trunk/src/OFS/interfaces.py
===
--- Zope/trunk/src/OFS/interfaces.py2010-06-18 09:24:59 UTC (rev 113611)
+++ Zope/trunk/src/OFS/interfaces.py2010-06-18 09:26:01 UTC (rev 113612)
@@ -10,13 +10,15 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##
-OFS z3 interfaces.
+OFS interfaces.
 
 $Id$
 
 from zope.container.interfaces import IContainer
 from zope.interface import Attribute
 from zope.interface import Interface
+from zope.location.interfaces import IPossibleSite
+from zope.location.interfaces import IRoot
 from zope.schema import Bool, BytesLine, Tuple
 
 from AccessControl.interfaces import IOwned
@@ -28,8 +30,6 @@
 from webdav.interfaces import IDAVCollection
 from webdav.interfaces import IDAVResource
 
-from zope.traversing.interfaces import IContainmentRoot
-from zope.location.interfaces import IPossibleSite
 
 class IOrderedContainer(Interface):
 
@@ -834,7 +834,7 @@
 # XXX: might contain non-API methods and outdated comments;
 #  not synced with ZopeBook API Reference;
 #  based on OFS.Application.Application
-class IApplication(IFolder, IContainmentRoot):
+class IApplication(IFolder, IRoot):
 
 Top-level system object
 

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


[Zope-Checkins] SVN: Zope/trunk/ - removed ancient backwards compatibility code

2010-06-17 Thread Yvo Schubbe
Log message for revision 113588:
  - removed ancient backwards compatibility code

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Zope2/App/startup.py
  U   Zope/trunk/src/Zope2/App/tests/testExceptionHook.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2010-06-17 09:03:52 UTC (rev 113587)
+++ Zope/trunk/doc/CHANGES.rst  2010-06-17 09:55:11 UTC (rev 113588)
@@ -11,6 +11,10 @@
 Restructuring
 +
 
+- ZPublisherExceptionHook: Removed ancient backwards compatibility code.
+  Customized raise_standardErrorMessage methods have to implement the
+  signature introduced in Zope 2.6.
+
 - Testing: Functional.publish now uses the real publish_module function
   instead of that from ZPublisher.Test. The 'extra' argument of the publish
   method is no longer supported.

Modified: Zope/trunk/src/Zope2/App/startup.py
===
--- Zope/trunk/src/Zope2/App/startup.py 2010-06-17 09:03:52 UTC (rev 113587)
+++ Zope/trunk/src/Zope2/App/startup.py 2010-06-17 09:55:11 UTC (rev 113588)
@@ -263,25 +263,20 @@
 if REQUEST.get('AUTHENTICATED_USER', None) is None:
 REQUEST['AUTHENTICATED_USER'] = AccessControl.User.nobody
 
-try:
-result = f(client, REQUEST, t, v, 
-   traceback, 
-   error_log_url=error_log_url)
-if result is not None:
-t, v, traceback = result
-if issubclass(t, Unauthorized):
-# Re-raise Unauthorized to make sure it is handled
-# correctly. We can't do that with all exceptions
-# because some don't work with the rendered v as
-# argument.
-raise t, v, traceback
-response = REQUEST.RESPONSE
-response.setStatus(t)
-response.setBody(v)
-return response
-except TypeError:
-# BBB: Pre Zope 2.6 call signature
-f(client, REQUEST, t, v, traceback)
+result = f(client, REQUEST, t, v, traceback,
+   error_log_url=error_log_url)
+if result is not None:
+t, v, traceback = result
+if issubclass(t, Unauthorized):
+# Re-raise Unauthorized to make sure it is handled
+# correctly. We can't do that with all exceptions
+# because some don't work with the rendered v as
+# argument.
+raise t, v, traceback
+response = REQUEST.RESPONSE
+response.setStatus(t)
+response.setBody(v)
+return response
 
 finally:
 traceback = None

Modified: Zope/trunk/src/Zope2/App/tests/testExceptionHook.py
===
--- Zope/trunk/src/Zope2/App/tests/testExceptionHook.py 2010-06-17 09:03:52 UTC 
(rev 113587)
+++ Zope/trunk/src/Zope2/App/tests/testExceptionHook.py 2010-06-17 09:55:11 UTC 
(rev 113588)
@@ -225,12 +225,6 @@
 def dummyMethod(self):
 return 'Aye'
 
-class OldClient(Client):
-
-def raise_standardErrorMessage(self, c, r, t, v, tb):
-from zExceptions.ExceptionFormatter import format_exception
-self.messages.append(''.join(format_exception(t, v, tb, as_html=0)))
-
 class StandardClient(Client):
 
 def raise_standardErrorMessage(self, c, r, t, v, tb, error_log_url):
@@ -245,17 +239,6 @@
 
 class ExceptionMessageRenderTest(ExceptionHookTestCase):
 
-def testRenderUnauthorizedOldClient(self):
-from AccessControl import Unauthorized
-def f():
-raise Unauthorized, 1
-request = self._makeRequest()
-client = OldClient()
-self.call(client, request, f)
-self.failUnless(client.messages, client.messages)
-tb = client.messages[0]
-self.failUnless(Unauthorized: You are not allowed in tb, tb)
-
 def testRenderUnauthorizedStandardClient(self):
 from AccessControl import Unauthorized
 def f():

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/BaseRequest.py - whitespace cleanup

2010-06-17 Thread Yvo Schubbe
Log message for revision 113589:
  - whitespace cleanup

Changed:
  U   Zope/trunk/src/ZPublisher/BaseRequest.py

-=-
Modified: Zope/trunk/src/ZPublisher/BaseRequest.py
===
--- Zope/trunk/src/ZPublisher/BaseRequest.py2010-06-17 09:55:11 UTC (rev 
113588)
+++ Zope/trunk/src/ZPublisher/BaseRequest.py2010-06-17 11:49:58 UTC (rev 
113589)
@@ -63,11 +63,11 @@
 class DefaultPublishTraverse(object):
 
 implements(IBrowserPublisher)
-
+
 def __init__(self, context, request):
 self.context = context
 self.request = request
-
+
 def publishTraverse(self, request, name):
 object = self.context
 URL=request['URL']
@@ -75,7 +75,6 @@
 if name[:1]=='_':
 raise Forbidden(Object name begins with an underscore at: %s % 
URL)
 
-
 if hasattr(object,'__bobo_traverse__'):
 try:
 subobject=object.__bobo_traverse__(request, name)
@@ -83,10 +82,10 @@
 # Add additional parents into the path
 # XXX There are no tests for this:
 request['PARENTS'][-1:] = list(subobject[:-1])
-object, subobject = subobject[-2:]
+object, subobject = subobject[-2:]
 except (AttributeError, KeyError, NotFound), e:
 # Try to find a view
-subobject = queryMultiAdapter((object, request), Interface, 
name)
+subobject = queryMultiAdapter((object, request), Interface, 
name)
 if subobject is not None:
 # OFS.Application.__bobo_traverse__ calls
 # REQUEST.RESPONSE.notFoundError which sets the HTTP
@@ -112,7 +111,7 @@
 if IAcquirer.providedBy(subobject):
 subobject = subobject.__of__(object)
 return subobject
-
+
 # And lastly, of there is no view, try acquired attributes, but
 # only if there is no __bobo_traverse__:
 try:
@@ -129,7 +128,6 @@
 subobject = object[name]
 except TypeError: # unsubscriptable
 raise KeyError(name)
-
 
 # Ensure that the object has a docstring, or that the parent
 # object has a pseudo-docstring for the object. Objects that
@@ -156,7 +154,7 @@
 )
 
 return subobject
-
+
 def browserDefault(self, request):
 if hasattr(self.context, '__browser_default__'):
 return self.context.__browser_default__(request)
@@ -169,8 +167,8 @@
 # A neater solution might be desireable.
 return self.context, ('@@' + default_name,)
 return self.context, ()
-
 
+
 _marker=[]
 class BaseRequest:
 Provide basic ZPublisher request management
@@ -285,7 +283,7 @@
 
 def __contains__(self, key):
 return self.has_key(key)
-
+
 def keys(self):
 keys = {}
 keys.update(self.common)
@@ -436,7 +434,7 @@
 path = request.path = request['TraversalRequestNameStack']
 # Check for method:
 if path:
-entry_name = path.pop() 
+entry_name = path.pop()
 else:
 # If we have reached the end of the path, we look to see
 # if we can find IBrowserPublisher.browserDefault. If so,
@@ -444,22 +442,22 @@
 # BrowserDefault returns the object to be published
 # (usually self) and a sequence of names to traverse to
 # find the method to be published.
-
+
 # This is webdav support. The last object in the path
 # should not be acquired. Instead, a NullResource should
 # be given if it doesn't exist:
 if (no_acquire_flag and
-hasattr(object, 'aq_base') and 
+hasattr(object, 'aq_base') and
 not hasattr(object,'__bobo_traverse__')):
 if object.aq_parent is not object.aq_inner.aq_parent:
 from webdav.NullResource import NullResource
 object = NullResource(parents[-2], object.getId(),
   self).__of__(parents[-2])
-
+
 if IBrowserPublisher.providedBy(object):
 adapter = object
 else:
-adapter = queryMultiAdapter((object, self), 
+adapter = queryMultiAdapter((object, self),
 IBrowserPublisher)
 if adapter is None:
  

[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/BaseRequest.py - removed unused variable

2010-06-17 Thread Yvo Schubbe
Log message for revision 113590:
  - removed unused variable

Changed:
  U   Zope/trunk/src/ZPublisher/BaseRequest.py

-=-
Modified: Zope/trunk/src/ZPublisher/BaseRequest.py
===
--- Zope/trunk/src/ZPublisher/BaseRequest.py2010-06-17 11:49:58 UTC (rev 
113589)
+++ Zope/trunk/src/ZPublisher/BaseRequest.py2010-06-17 11:52:57 UTC (rev 
113590)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
  Basic ZPublisher request management.
@@ -372,7 +372,7 @@
 path=clean
 
 # How did this request come in? (HTTP GET, PUT, POST, etc.)
-method=req_method=request_get('REQUEST_METHOD', 'GET').upper()
+method = request_get('REQUEST_METHOD', 'GET').upper()
 
 if method=='GET' or method=='POST' and not isinstance(response,
   xmlrpc.Response):

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


[Zope-Checkins] SVN: Zope/trunk/src/ - TraversalError is now LocationError

2010-06-17 Thread Yvo Schubbe
Log message for revision 113591:
  - TraversalError is now LocationError
  - import cleanup

Changed:
  U   Zope/trunk/src/OFS/Traversable.py
  U   Zope/trunk/src/ZPublisher/BaseRequest.py

-=-
Modified: Zope/trunk/src/OFS/Traversable.py
===
--- Zope/trunk/src/OFS/Traversable.py   2010-06-17 11:52:57 UTC (rev 113590)
+++ Zope/trunk/src/OFS/Traversable.py   2010-06-17 11:56:46 UTC (rev 113591)
@@ -35,7 +35,7 @@
 from zope.interface import implements
 from zope.interface import Interface
 from zope.component import queryMultiAdapter
-from zope.traversing.interfaces import TraversalError
+from zope.location.interfaces import LocationError
 from zope.traversing.namespace import namespaceLookup
 from zope.traversing.namespace import nsParse
 
@@ -68,7 +68,7 @@
 return self.virtual_url_path()
 
 spp = self.getPhysicalPath()
-
+
 try:
 toUrl = aq_acquire(self, 'REQUEST').physicalPathToURL
 except AttributeError:
@@ -204,7 +204,7 @@
 if restricted and not validate(
 obj, obj, name, next):
 raise Unauthorized(name)
-except TraversalError:
+except LocationError:
 raise AttributeError(name)
 
 elif bobo_traverse is not None:

Modified: Zope/trunk/src/ZPublisher/BaseRequest.py
===
--- Zope/trunk/src/ZPublisher/BaseRequest.py2010-06-17 11:52:57 UTC (rev 
113590)
+++ Zope/trunk/src/ZPublisher/BaseRequest.py2010-06-17 11:56:46 UTC (rev 
113591)
@@ -14,22 +14,26 @@
 
 $Id$
 
+
 from urllib import quote as urllib_quote
 import xmlrpc
-from zExceptions import Forbidden, NotFound
+
 from Acquisition import aq_base
 from Acquisition.interfaces import IAcquirer
-
-from zope.interface import implements, Interface
+from zExceptions import Forbidden
+from zExceptions import NotFound
 from zope.component import queryMultiAdapter
 from zope.event import notify
+from zope.interface import implements
+from zope.interface import Interface
+from zope.location.interfaces import LocationError
 from zope.publisher.defaultview import queryDefaultViewName
 from zope.publisher.interfaces import EndRequestEvent
 from zope.publisher.interfaces import IPublishTraverse
 from zope.publisher.interfaces import NotFound as ztkNotFound
 from zope.publisher.interfaces.browser import IBrowserPublisher
-from zope.traversing.interfaces import TraversalError
-from zope.traversing.namespace import nsParse, namespaceLookup
+from zope.traversing.namespace import namespaceLookup
+from zope.traversing.namespace import nsParse
 
 UNSPECIFIED_ROLES=''
 
@@ -319,7 +323,7 @@
 if ns:
 try:
 ob2 = namespaceLookup(ns, nm, ob, self)
-except TraversalError:
+except LocationError:
 raise ztkNotFound(ob, name)
 
 if IAcquirer.providedBy(ob2):

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


[Zope-Checkins] SVN: Zope/trunk/src/Testing/ZopeTestCase/functional.py - removed ZPublisher.Test.publish_module dependency

2010-06-07 Thread Yvo Schubbe
Log message for revision 113238:
  - removed ZPublisher.Test.publish_module dependency
  
  the 'extra' argument of the publish method is no longer supported
  (I hope nobody did use it - let's see if someone complains about this BBB 
foul)

Changed:
  U   Zope/trunk/src/Testing/ZopeTestCase/functional.py

-=-
Modified: Zope/trunk/src/Testing/ZopeTestCase/functional.py
===
--- Zope/trunk/src/Testing/ZopeTestCase/functional.py   2010-06-07 14:27:51 UTC 
(rev 113237)
+++ Zope/trunk/src/Testing/ZopeTestCase/functional.py   2010-06-07 14:53:48 UTC 
(rev 113238)
@@ -55,21 +55,19 @@
 implements(interfaces.IFunctional)
 
 @savestate
-def publish(self, path, basic=None, env=None, extra=None,
-request_method='GET', stdin=None, handle_errors=True):
+def publish(self, path, basic=None, env=None, request_method='GET',
+stdin=None, handle_errors=True):
 '''Publishes the object at 'path' returning a response object.'''
 
 from StringIO import StringIO
 from ZPublisher.Response import Response
-from ZPublisher.Test import publish_module
+from ZPublisher.Publish import publish_module
 
 # Commit the sandbox for good measure
 transaction.commit()
 
 if env is None:
 env = {}
-if extra is None:
-extra = {}
 
 request = self.app.REQUEST
 
@@ -98,7 +96,6 @@
response=response,
stdin=stdin,
environ=env,
-   extra=extra,
debug=not handle_errors,
   )
 

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


[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.rst - mention rev 113238 in the changelog

2010-06-07 Thread Yvo Schubbe
Log message for revision 113239:
  - mention rev 113238 in the changelog

Changed:
  U   Zope/trunk/doc/CHANGES.rst

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2010-06-07 14:53:48 UTC (rev 113238)
+++ Zope/trunk/doc/CHANGES.rst  2010-06-07 15:31:50 UTC (rev 113239)
@@ -11,6 +11,10 @@
 Restructuring
 +
 
+- Testing: Functional.publish now uses the real publish_module function
+  instead of that from ZPublisher.Test. The 'extra' argument of the publish
+  method is no longer supported.
+
 - Removed the deprecated ``hasRole`` method from user objects.
 
 - Removed deprecated support for specifying ``__ac_permissions__``,

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


[Zope-Checkins] SVN: Zope/branches/2.12/ - fixed handling of errors in 'traverseName'

2010-04-24 Thread Yvo Schubbe
Log message for revision 111338:
  - fixed handling of errors in 'traverseName'

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/ZPublisher/BaseRequest.py
  U   Zope/branches/2.12/src/ZPublisher/tests/testBaseRequest.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-04-24 10:36:46 UTC (rev 111337)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-04-24 10:56:28 UTC (rev 111338)
@@ -15,6 +15,11 @@
 
   - ZODB3 = 3.9.5
 
+Bugs Fixed
+++
+
+- BaseRequest: Fixed handling of errors in 'traverseName'.
+
 2.12.5 (2010-04-24)
 ---
 

Modified: Zope/branches/2.12/src/ZPublisher/BaseRequest.py
===
--- Zope/branches/2.12/src/ZPublisher/BaseRequest.py2010-04-24 10:36:46 UTC 
(rev 111337)
+++ Zope/branches/2.12/src/ZPublisher/BaseRequest.py2010-04-24 10:56:28 UTC 
(rev 111338)
@@ -26,6 +26,7 @@
 from zope.app.publication.interfaces import EndRequestEvent
 from zope.publisher.defaultview import queryDefaultViewName
 from zope.publisher.interfaces import IPublishTraverse
+from zope.publisher.interfaces import NotFound as ztkNotFound
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.traversing.interfaces import TraversalError
 from zope.traversing.namespace import nsParse, namespaceLookup
@@ -312,7 +313,7 @@
 
 __repr__=__str__
 
-
+# Original version: see zope.traversing.publicationtraverse
 def traverseName(self, ob, name):
 if name and name[:1] in '@+':
 # Process URI segment parameters.
@@ -321,7 +322,7 @@
 try:
 ob2 = namespaceLookup(ns, nm, ob, self)
 except TraversalError:
-raise KeyError(ob, name)
+raise ztkNotFound(ob, name)
 
 if IAcquirer.providedBy(ob2):
 ob2 = ob2.__of__(ob)
@@ -343,7 +344,6 @@
 
 return ob2
 
-
 def traverse(self, path, response=None, validated_hook=None):
 Traverse the object space
 
@@ -506,7 +506,8 @@
 object, check_name, subobject,
 self.roles)
 object = subobject
-except (KeyError, AttributeError):
+# traverseName() might raise ZTK's NotFound
+except (KeyError, AttributeError, ztkNotFound):
 if response.debug_mode:
 return response.debugError(
 Cannot locate object at: %s % URL)
@@ -517,7 +518,6 @@
 return response.debugError(e.args)
 else: 
 return response.forbiddenError(entry_name)
-
 
 parents.append(object)
 
@@ -711,8 +711,7 @@
 # types during publishing, we ensure the same publishing rules in
 # both versions. The downside is that this needs to be extended as
 # new built-in types are added and future Python versions are
-# supported. That happens rarely enough that hopefully we'll be on
-# Zope 3 by then :)
+# supported.
 
 import types
 

Modified: Zope/branches/2.12/src/ZPublisher/tests/testBaseRequest.py
===
--- Zope/branches/2.12/src/ZPublisher/tests/testBaseRequest.py  2010-04-24 
10:36:46 UTC (rev 111337)
+++ Zope/branches/2.12/src/ZPublisher/tests/testBaseRequest.py  2010-04-24 
10:56:28 UTC (rev 111338)
@@ -1,5 +1,20 @@
 import unittest
 
+from zope.interface import implements
+from zope.publisher.interfaces import IPublishTraverse
+from zope.publisher.interfaces import NotFound as ztkNotFound
+
+
+class DummyTraverser(object):
+
+implements(IPublishTraverse)
+
+def publishTraverse(self, request, name):
+if name == 'dummy':
+return 'dummy object'
+raise ztkNotFound(self, name)
+
+
 class BaseRequest_factory:
 
 def _makeOne(self, root):
@@ -138,6 +153,7 @@
 return 'unpublishable'
 return DummyObjectWithEmptyDocstring()
 
+
 class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
 
 def _getTargetClass(self):
@@ -372,13 +388,19 @@
 def test_traverse_unsubscriptable(self):
 # See https://bugs.launchpad.net/bugs/213311
 from ZPublisher import NotFound
-class _Object(object):
-pass
-root = _Object()
 r = self._makeOne(None)
 self.assertRaises(NotFound, r.traverse, 'not_found')
 
+def test_traverse_publishTraverse(self):
+r = self._makeOne(DummyTraverser())
+self.assertEqual(r.traverse('dummy'), 'dummy object')
 
+def test_traverse_publishTraverse_error(self):
+from ZPublisher import NotFound
+r = self._makeOne(DummyTraverser())
+self.assertRaises(NotFound, r.traverse, 'not_found')
+
+
 class 

[Zope-Checkins] SVN: Zope/branches/2.12/src/ZPublisher/Publish.py - reverted part of r105590: retry is not defined here (this bug is not in Zope trunk)

2010-04-22 Thread Yvo Schubbe
Log message for revision 111260:
  - reverted part of r105590: retry is not defined here (this bug is not in 
Zope trunk)

Changed:
  U   Zope/branches/2.12/src/ZPublisher/Publish.py

-=-
Modified: Zope/branches/2.12/src/ZPublisher/Publish.py
===
--- Zope/branches/2.12/src/ZPublisher/Publish.py2010-04-22 11:21:26 UTC 
(rev 111259)
+++ Zope/branches/2.12/src/ZPublisher/Publish.py2010-04-22 11:35:45 UTC 
(rev 111260)
@@ -208,7 +208,7 @@
 transactions_manager.abort()
 finally:
 endInteraction()
-notify(PubFailure(request, exc_info, retry))
+notify(PubFailure(request, exc_info, False))
 raise
 
 def publish_module_standard(module_name,

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/Publish.py - forward ported r105590 from 2.12 branch

2010-04-22 Thread Yvo Schubbe
Log message for revision 111261:
  - forward ported r105590 from 2.12 branch

Changed:
  U   Zope/trunk/src/ZPublisher/Publish.py

-=-
Modified: Zope/trunk/src/ZPublisher/Publish.py
===
--- Zope/trunk/src/ZPublisher/Publish.py2010-04-22 11:35:45 UTC (rev 
111260)
+++ Zope/trunk/src/ZPublisher/Publish.py2010-04-22 11:37:30 UTC (rev 
111261)
@@ -173,14 +173,13 @@
 )
 retry = True
 finally:
-
 # Note: 'abort's can fail. Nevertheless, we want end request 
handling
-try: 
-
-notify(PubBeforeAbort(request, exc_info, retry))
-
-if transactions_manager:
-transactions_manager.abort()
+try:
+try:
+notify(PubBeforeAbort(request, exc_info, retry))
+finally:
+if transactions_manager:
+transactions_manager.abort()
 finally:
 endInteraction()
 notify(PubFailure(request, exc_info, retry))
@@ -200,17 +199,16 @@
 else:
 # Note: 'abort's can fail. Nevertheless, we want end request 
handling
 try:
-
-notify(PubBeforeAbort(request, exc_info, False))
-
-if transactions_manager:
-transactions_manager.abort()
+try:
+notify(PubBeforeAbort(request, exc_info, False))
+finally:
+if transactions_manager:
+transactions_manager.abort()
 finally:
 endInteraction()
 notify(PubFailure(request, exc_info, False))
 raise
 
-
 def publish_module_standard(module_name,
stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,
environ=os.environ, debug=0, request=None, response=None):

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/ - moved special debug (== not handle_errors != debug mode) behavior up the stack

2010-04-22 Thread Yvo Schubbe
Log message for revision 111262:
  - moved special debug (== not handle_errors != debug mode) behavior up the 
stack

Changed:
  U   Zope/branches/2.12/src/OFS/SimpleItem.py
  U   Zope/branches/2.12/src/ZPublisher/Publish.py

-=-
Modified: Zope/branches/2.12/src/OFS/SimpleItem.py
===
--- Zope/branches/2.12/src/OFS/SimpleItem.py2010-04-22 11:37:30 UTC (rev 
111261)
+++ Zope/branches/2.12/src/OFS/SimpleItem.py2010-04-22 12:16:41 UTC (rev 
111262)
@@ -235,14 +235,6 @@
 if not REQUEST:
 REQUEST = aq_acquire(self, 'REQUEST')
 
-handle_errors = getattr(getattr(REQUEST, 'RESPONSE', None),
-'handle_errors', False)
-if not handle_errors:
-# If we have been asked not to handle errors don't even bother
-# with transforming the exception into HTML. Just re-raise the
-# original exception right away.
-raise error_type, error_value, tb
-
 try:
 s = aq_acquire(client, 'standard_error_message')
 

Modified: Zope/branches/2.12/src/ZPublisher/Publish.py
===
--- Zope/branches/2.12/src/ZPublisher/Publish.py2010-04-22 11:37:30 UTC 
(rev 111261)
+++ Zope/branches/2.12/src/ZPublisher/Publish.py2010-04-22 12:16:41 UTC 
(rev 111262)
@@ -153,7 +153,8 @@
 getattr(cl,'__name__',cl), val,
 debug_mode and compact_traceback()[-1] or ''))
 
-if err_hook is not None:
+# debug is just used by tests (has nothing to do with debug_mode!)
+if not debug and err_hook is not None:
 retry = False
 if parents:
 parents=parents[0]

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


[Zope-Checkins] SVN: Zope/trunk/src/ - moved special debug (== not handle_errors != debug mode) behavior up the stack

2010-04-22 Thread Yvo Schubbe
Log message for revision 111263:
  - moved special debug (== not handle_errors != debug mode) behavior up the 
stack

Changed:
  U   Zope/trunk/src/OFS/SimpleItem.py
  U   Zope/trunk/src/ZPublisher/Publish.py

-=-
Modified: Zope/trunk/src/OFS/SimpleItem.py
===
--- Zope/trunk/src/OFS/SimpleItem.py2010-04-22 12:16:41 UTC (rev 111262)
+++ Zope/trunk/src/OFS/SimpleItem.py2010-04-22 12:17:36 UTC (rev 111263)
@@ -235,14 +235,6 @@
 if not REQUEST:
 REQUEST = aq_acquire(self, 'REQUEST')
 
-handle_errors = getattr(getattr(REQUEST, 'RESPONSE', None),
-'handle_errors', False)
-if not handle_errors:
-# If we have been asked not to handle errors don't even bother
-# with transforming the exception into HTML. Just re-raise the
-# original exception right away.
-raise error_type, error_value, tb
-
 try:
 s = aq_acquire(client, 'standard_error_message')
 

Modified: Zope/trunk/src/ZPublisher/Publish.py
===
--- Zope/trunk/src/ZPublisher/Publish.py2010-04-22 12:16:41 UTC (rev 
111262)
+++ Zope/trunk/src/ZPublisher/Publish.py2010-04-22 12:17:36 UTC (rev 
111263)
@@ -153,7 +153,8 @@
 getattr(cl,'__name__',cl), val,
 debug_mode and compact_traceback()[-1] or ''))
 
-if err_hook is not None:
+# debug is just used by tests (has nothing to do with debug_mode!)
+if not debug and err_hook is not None:
 retry = False
 if parents:
 parents=parents[0]

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


[Zope-Checkins] SVN: Zope/branches/2.12/ - fixed handling of exceptions with unicode values

2010-04-21 Thread Yvo Schubbe
Log message for revision 99:
  - fixed handling of exceptions with unicode values

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  UU  Zope/branches/2.12/src/ZPublisher/HTTPResponse.py
  U   Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-04-21 08:08:50 UTC (rev 98)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-04-21 09:00:13 UTC (rev 99)
@@ -55,6 +55,8 @@
 Bugs Fixed
 ++
 
+- HTTPResponse: Fixed handling of exceptions with unicode values.
+
 - zExceptions: Fixed some unicode issues in Unauthorized.
 
 - LP #372632, comments #15ff.: Fixed regression in Unauthorized handling.

Modified: Zope/branches/2.12/src/ZPublisher/HTTPResponse.py
===
--- Zope/branches/2.12/src/ZPublisher/HTTPResponse.py   2010-04-21 08:08:50 UTC 
(rev 98)
+++ Zope/branches/2.12/src/ZPublisher/HTTPResponse.py   2010-04-21 09:00:13 UTC 
(rev 99)
@@ -800,7 +800,10 @@
 b = v
 if isinstance(b, Exception):
 try:
-b = str(b)
+try:
+b = str(b)
+except UnicodeEncodeError:
+b = self._encode_unicode(unicode(b))
 except:
 b = 'unprintable %s object' % type(b).__name__
 


Property changes on: Zope/branches/2.12/src/ZPublisher/HTTPResponse.py
___
Deleted: cvs2svn:cvs-rev
   - 1.81

Modified: Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt
===
--- Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-21 08:08:50 UTC (rev 98)
+++ Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-21 09:00:13 UTC (rev 99)
@@ -140,6 +140,28 @@
 ...
 Unauthorized: ERROR VALUE
 
+And the same with unicode error value.
+
+ app.test_folder_1_.foo.exception = Unauthorized(u'ERROR VALUE \u03A9')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 401: Unauthorized
+ 'Error Type: Unauthorized' in browser.contents
+True
+ 'Error Value: ERROR VALUE ?' in browser.contents
+True
+ browser.headers['WWW-Authenticate']
+'basic realm=Zope2'
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+Unauthorized: unprintable ... object
+
 Handle zExceptions.Unauthorized raised by BaseRequest.traverse. We take the
 'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
 

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/ - fixed handling of exceptions with unicode values

2010-04-21 Thread Yvo Schubbe
Log message for revision 111200:
  - fixed handling of exceptions with unicode values

Changed:
  U   Zope/trunk/src/ZPublisher/HTTPResponse.py
  U   Zope/trunk/src/ZPublisher/tests/exception_handling.txt

-=-
Modified: Zope/trunk/src/ZPublisher/HTTPResponse.py
===
--- Zope/trunk/src/ZPublisher/HTTPResponse.py   2010-04-21 09:00:13 UTC (rev 
99)
+++ Zope/trunk/src/ZPublisher/HTTPResponse.py   2010-04-21 09:01:04 UTC (rev 
111200)
@@ -795,7 +795,10 @@
 b = v
 if isinstance(b, Exception):
 try:
-b = str(b)
+try:
+b = str(b)
+except UnicodeEncodeError:
+b = self._encode_unicode(unicode(b))
 except:
 b = 'unprintable %s object' % type(b).__name__
 

Modified: Zope/trunk/src/ZPublisher/tests/exception_handling.txt
===
--- Zope/trunk/src/ZPublisher/tests/exception_handling.txt  2010-04-21 
09:00:13 UTC (rev 99)
+++ Zope/trunk/src/ZPublisher/tests/exception_handling.txt  2010-04-21 
09:01:04 UTC (rev 111200)
@@ -147,6 +147,29 @@
 Unauthorized: ERROR VALUE
  browser.contents
 
+And the same with unicode error value.
+
+ app.test_folder_1_.foo.exception = Unauthorized(u'ERROR VALUE \u03A9')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 401: Unauthorized
+ 'Error Type: Unauthorized' in browser.contents
+True
+ 'Error Value: ERROR VALUE ?' in browser.contents
+True
+ browser.headers['WWW-Authenticate']
+'basic realm=Zope2'
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+Unauthorized: unprintable ... object
+ browser.contents
+
 Handle zExceptions.Unauthorized raised by BaseRequest.traverse. We take the
 'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
 

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/ZPublisher/tests/ - added one more Unauthorized test

2010-04-19 Thread Yvo Schubbe
Log message for revision 111074:
  - added one more Unauthorized test

Changed:
  U   Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt
  U   Zope/branches/2.12/src/ZPublisher/tests/test_exception_handling.py

-=-
Modified: Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt
===
--- Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-19 09:29:33 UTC (rev 111073)
+++ Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-19 09:41:23 UTC (rev 111074)
@@ -16,6 +16,7 @@
  
  dummy = app.test_folder_1_._setObject('foo', ExceptionRaiser1())
  dummy = app.test_folder_1_._setObject('bar', ExceptionRaiser2())
+ dummy = app.test_folder_1_._setObject('baz', ExceptionRaiser3())
 
 Handle AttributeError.
 
@@ -115,8 +116,8 @@
 ...
 Redirect: LOCATION
 
-Handle zExceptions.Unauthorized. We take the 'WWW-Authenticate' header as a
-sign that HTTPResponse._unauthorized was called.
+Handle zExceptions.Unauthorized raised by the object. We take the
+'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
 
  from zExceptions import Unauthorized
  app.test_folder_1_.foo.exception = Unauthorized('ERROR VALUE')
@@ -139,13 +140,34 @@
 ...
 Unauthorized: ERROR VALUE
 
-Handle zExceptions.Forbidden in BaseRequest.traverse. 'traverse' converts it
-into zExceptions.NotFound if we are not in debug mode.
+Handle zExceptions.Unauthorized raised by BaseRequest.traverse. We take the
+'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
 
  browser.handleErrors = True
  browser.open('http://localhost/test_folder_1_/bar')
 Traceback (most recent call last):
 ...
+HTTPError: HTTP Error 401: Unauthorized
+ 'Site Error' in browser.contents
+True
+ 'You are not authorized to access this resource.' in browser.contents
+True
+ browser.headers['WWW-Authenticate']
+'basic realm=Zope2'
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/bar')
+Traceback (most recent call last):
+...
+Unauthorized: strongYou are not authorized to access this resource...
+
+Handle zExceptions.Forbidden raised by BaseRequest.traverse. 'traverse'
+converts it into zExceptions.NotFound if we are not in debug mode.
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/baz')
+Traceback (most recent call last):
+...
 HTTPError: HTTP Error 404: Not Found
  'pstrongResource not found/strong/p' in browser.contents
 True
@@ -153,7 +175,7 @@
 True
 
  browser.handleErrors = False
- browser.open('http://localhost/test_folder_1_/bar')
+ browser.open('http://localhost/test_folder_1_/baz')
 Traceback (most recent call last):
 ...
 NotFound:   h2Site Error/h2

Modified: Zope/branches/2.12/src/ZPublisher/tests/test_exception_handling.py
===
--- Zope/branches/2.12/src/ZPublisher/tests/test_exception_handling.py  
2010-04-19 09:29:33 UTC (rev 111073)
+++ Zope/branches/2.12/src/ZPublisher/tests/test_exception_handling.py  
2010-04-19 09:41:23 UTC (rev 111074)
@@ -29,8 +29,13 @@
 raise self.exception
 
 
-class ExceptionRaiser2(SimpleItem):
+class ExceptionRaiser2(ExceptionRaiser1):
 
+__roles__ = ()
+
+
+class ExceptionRaiser3(SimpleItem):
+
 def index_html(self):
 return 'NO DOCSTRING'
 
@@ -39,7 +44,8 @@
 return unittest.TestSuite([
 FunctionalDocFileSuite('exception_handling.txt',
 globs={'ExceptionRaiser1': ExceptionRaiser1,
-   'ExceptionRaiser2': ExceptionRaiser2,}),
+   'ExceptionRaiser2': ExceptionRaiser2,
+   'ExceptionRaiser3': ExceptionRaiser3,}),
 ])
 
 if __name__ == '__main__':

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/tests/ - added one more Unauthorized test

2010-04-19 Thread Yvo Schubbe
Log message for revision 111075:
  - added one more Unauthorized test

Changed:
  U   Zope/trunk/src/ZPublisher/tests/exception_handling.txt
  U   Zope/trunk/src/ZPublisher/tests/test_exception_handling.py

-=-
Modified: Zope/trunk/src/ZPublisher/tests/exception_handling.txt
===
--- Zope/trunk/src/ZPublisher/tests/exception_handling.txt  2010-04-19 
09:41:23 UTC (rev 111074)
+++ Zope/trunk/src/ZPublisher/tests/exception_handling.txt  2010-04-19 
09:41:47 UTC (rev 111075)
@@ -16,6 +16,7 @@
  
  dummy = app.test_folder_1_._setObject('foo', ExceptionRaiser1())
  dummy = app.test_folder_1_._setObject('bar', ExceptionRaiser2())
+ dummy = app.test_folder_1_._setObject('baz', ExceptionRaiser3())
 
 Handle AttributeError.
 
@@ -121,8 +122,8 @@
 Redirect: LOCATION
  browser.contents
 
-Handle zExceptions.Unauthorized. We take the 'WWW-Authenticate' header as a
-sign that HTTPResponse._unauthorized was called.
+Handle zExceptions.Unauthorized raised by the object. We take the
+'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
 
  from zExceptions import Unauthorized
  app.test_folder_1_.foo.exception = Unauthorized('ERROR VALUE')
@@ -146,13 +147,35 @@
 Unauthorized: ERROR VALUE
  browser.contents
 
-Handle zExceptions.Forbidden in BaseRequest.traverse. 'traverse' converts it
-into zExceptions.NotFound if we are not in debug mode.
+Handle zExceptions.Unauthorized raised by BaseRequest.traverse. We take the
+'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
 
  browser.handleErrors = True
  browser.open('http://localhost/test_folder_1_/bar')
 Traceback (most recent call last):
 ...
+HTTPError: HTTP Error 401: Unauthorized
+ 'Site Error' in browser.contents
+True
+ 'You are not authorized to access this resource.' in browser.contents
+True
+ browser.headers['WWW-Authenticate']
+'basic realm=Zope2'
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/bar')
+Traceback (most recent call last):
+...
+Unauthorized: strongYou are not authorized to access this resource...
+ browser.contents
+
+Handle zExceptions.Forbidden raised by BaseRequest.traverse. 'traverse'
+converts it into zExceptions.NotFound if we are not in debug mode.
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/baz')
+Traceback (most recent call last):
+...
 HTTPError: HTTP Error 404: Not Found
  'pstrongResource not found/strong/p' in browser.contents
 True
@@ -160,7 +183,7 @@
 True
 
  browser.handleErrors = False
- browser.open('http://localhost/test_folder_1_/bar')
+ browser.open('http://localhost/test_folder_1_/baz')
 Traceback (most recent call last):
 ...
 NotFound:   h2Site Error/h2

Modified: Zope/trunk/src/ZPublisher/tests/test_exception_handling.py
===
--- Zope/trunk/src/ZPublisher/tests/test_exception_handling.py  2010-04-19 
09:41:23 UTC (rev 111074)
+++ Zope/trunk/src/ZPublisher/tests/test_exception_handling.py  2010-04-19 
09:41:47 UTC (rev 111075)
@@ -29,8 +29,13 @@
 raise self.exception
 
 
-class ExceptionRaiser2(SimpleItem):
+class ExceptionRaiser2(ExceptionRaiser1):
 
+__roles__ = ()
+
+
+class ExceptionRaiser3(SimpleItem):
+
 def index_html(self):
 return 'NO DOCSTRING'
 
@@ -39,7 +44,8 @@
 return unittest.TestSuite([
 FunctionalDocFileSuite('exception_handling.txt',
 globs={'ExceptionRaiser1': ExceptionRaiser1,
-   'ExceptionRaiser2': ExceptionRaiser2,}),
+   'ExceptionRaiser2': ExceptionRaiser2,
+   'ExceptionRaiser3': ExceptionRaiser3,}),
 ])
 
 if __name__ == '__main__':

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/HTTPResponse.py - removed redundant _unauthorized() call. exception() will call it later in the process.

2010-04-19 Thread Yvo Schubbe
Log message for revision 111077:
  - removed redundant _unauthorized() call. exception() will call it later in 
the process.
  - removed obsolete code that did support string exceptions
  - some related cleanup

Changed:
  UU  Zope/trunk/src/ZPublisher/HTTPResponse.py

-=-
Modified: Zope/trunk/src/ZPublisher/HTTPResponse.py
===
--- Zope/trunk/src/ZPublisher/HTTPResponse.py   2010-04-19 09:42:44 UTC (rev 
111076)
+++ Zope/trunk/src/ZPublisher/HTTPResponse.py   2010-04-19 10:00:00 UTC (rev 
111077)
@@ -1,19 +1,18 @@
-#
+##
 #
 # Copyright (c) 2001 Zope Foundation and Contributors.
 #
 # This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 '''CGI Response Output formatter
 
 $Id$'''
-__version__ = '$Revision: 1.81 $'[11:-2]
 
 import types, os, sys, re
 import zlib, struct
@@ -247,7 +246,7 @@
 self.errmsg = reason
 # lock the status if we're told to
 if lock:
- self._locked_status = 1
+self._locked_status = 1
 
 def setHeader(self, name, value, literal=0, scrubbed=False):
 '''\
@@ -710,7 +709,6 @@
 self.setHeader('WWW-Authenticate', 'basic realm=%s' % realm, 1)
 
 def unauthorized(self):
-self._unauthorized()
 m = strongYou are not authorized to access this resource./strong
 if self.debug_mode:
 if self._auth:
@@ -724,15 +722,12 @@
   tag_search=re.compile('[a-zA-Z]').search,
   abort=1
   ):
-if type(info) is type(()) and len(info) == 3:
+if isinstance(info, tuple) and len(info) == 3:
 t, v, tb = info
 else:
 t, v, tb = sys.exc_info()
 
-if t == 'Unauthorized' or t == Unauthorized or (
-isinstance(t, (type, types.ClassType)) and
-issubclass(t, Unauthorized)):
-t = 'Unauthorized'
+if issubclass(t, Unauthorized):
 self._unauthorized()
 
 stb = tb # note alias between tb and stb


Property changes on: Zope/trunk/src/ZPublisher/HTTPResponse.py
___
Deleted: cvs2svn:cvs-rev
   - 1.81

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/OFS/SimpleItem.py - backported changes from trunk

2010-04-19 Thread Yvo Schubbe
Log message for revision 111079:
  - backported changes from trunk

Changed:
  U   Zope/branches/2.12/src/OFS/SimpleItem.py

-=-
Modified: Zope/branches/2.12/src/OFS/SimpleItem.py
===
--- Zope/branches/2.12/src/OFS/SimpleItem.py2010-04-19 10:04:12 UTC (rev 
111078)
+++ Zope/branches/2.12/src/OFS/SimpleItem.py2010-04-19 10:07:30 UTC (rev 
111079)
@@ -20,12 +20,10 @@
 $Id$
 
 
-import inspect
 import marshal
 import re
 import sys
 import time
-import warnings
 
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from AccessControl.SecurityManagement import getSecurityManager
@@ -118,7 +116,7 @@
 # Alias id to __name__, which will make tracebacks a good bit nicer:
 __name__=ComputedAttribute(lambda self: self.getId())
 
-# Name, relative to SOFTWARE_URL of icon used to display item
+# Name, relative to BASEPATH1 of icon used to display item
 # in folder listings.
 icon=''
 
@@ -239,35 +237,10 @@
 
 handle_errors = getattr(getattr(REQUEST, 'RESPONSE', None),
 'handle_errors', False)
-# Can we re-raise the exception with a rendered-to-HTML
-# exception value? To be able to do so, the exception
-# constructor needs to be able to take more than two
-# arguments (some Zope 3 exceptions can't).
-can_raise = False
-ctor = getattr(error_type, '__init__', None)
-if inspect.ismethoddescriptor(ctor):
-# If it's a method descriptor, it means we've got a
-# base ``__init__`` method that was not overriden,
-# likely from the base ``Exception`` class.
-can_raise = True
-else:
-if inspect.ismethod(ctor):
-ctor = getattr(ctor, 'im_func', None)
-if inspect.isbuiltin(ctor):
-# In Python 2.4, the ``__init__`` method of the
-# base ``Exception`` class is a ``builtin
-# method``.
-can_raise = True
-elif ctor is not None and inspect.isfunction(ctor):
-can_raise = (
-len(inspect.getargspec(error_type.__init__)[0])  2)
-
-if not (can_raise and handle_errors):
-# If we have been asked not to handle errors and we
-# can't re-raise a transformed exception don't even
-# bother with transforming the exception into
-# HTML. Just re-raise the original exception right
-# away.
+if not handle_errors:
+# If we have been asked not to handle errors don't even bother
+# with transforming the exception into HTML. Just re-raise the
+# original exception right away.
 raise error_type, error_value, tb
 
 try:
@@ -306,12 +279,9 @@
 html_quote(sys.exc_info()[1]),
 ))
 
-if handle_errors:
-# If we've been asked to handle errors, just
-# return the rendered exception and let the
-# ZPublisher Exception Hook deal with it.
-return error_type, v, tb
-raise error_type, v, tb
+# If we've been asked to handle errors, just return the rendered
+# exception and let the ZPublisher Exception Hook deal with it.
+return error_type, v, tb
 finally:
 if hasattr(self, '_v_eek'): del self._v_eek
 tb = None

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


[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/ - left behind some comments for the next person who tries to understand that code

2010-04-17 Thread Yvo Schubbe
Log message for revision 111013:
  - left behind some comments for the next person who tries to understand that 
code
  - re-synced Test.publish_module with Publish.publish_module_standard

Changed:
  U   Zope/trunk/src/ZPublisher/Publish.py
  U   Zope/trunk/src/ZPublisher/Test.py

-=-
Modified: Zope/trunk/src/ZPublisher/Publish.py
===
--- Zope/trunk/src/ZPublisher/Publish.py2010-04-17 00:37:40 UTC (rev 
111012)
+++ Zope/trunk/src/ZPublisher/Publish.py2010-04-17 09:04:22 UTC (rev 
111013)
@@ -224,6 +224,7 @@
 else:
 stdout=response.stdout
 
+# debug is just used by tests (has nothing to do with debug_mode!)
 response.handle_errors = not debug
 
 if request is None:
@@ -237,9 +238,16 @@
 
 response = publish(request, module_name, after_list, debug=debug)
 except (SystemExit, ImportError):
+# XXX: Rendered ImportErrors were never caught here because they
+# were re-raised as string exceptions. Maybe we should handle
+# ImportErrors like all other exceptions. Currently they are not
+# re-raised at all, so they don't show up here.
 must_die = sys.exc_info()
 request.response.exception(1)
 except:
+# debug is just used by tests (has nothing to do with debug_mode!)
+if debug:
+raise
 request.response.exception()
 status = response.getStatus()
 

Modified: Zope/trunk/src/ZPublisher/Test.py
===
--- Zope/trunk/src/ZPublisher/Test.py   2010-04-17 00:37:40 UTC (rev 111012)
+++ Zope/trunk/src/ZPublisher/Test.py   2010-04-17 09:04:22 UTC (rev 111013)
@@ -189,6 +189,7 @@
 else:
 stdout=response.stdout
 
+# debug is just used by tests (has nothing to do with debug_mode!)
 response.handle_errors = not debug
 
 if request is None:
@@ -203,9 +204,14 @@
 for k, v in extra.items(): request[k]=v
 response = publish(request, module_name, after_list, debug=debug)
 except (SystemExit, ImportError):
+# XXX: Rendered ImportErrors were never caught here because they
+# were re-raised as string exceptions. Maybe we should handle
+# ImportErrors like all other exceptions. Currently they are not
+# re-raised at all, so they don't show up here.
 must_die = sys.exc_info()
 request.response.exception(1)
 except:
+# debug is just used by tests (has nothing to do with debug_mode!)
 if debug:
 raise
 request.response.exception()

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


[Zope-Checkins] SVN: Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/functional.py - no need to use the Test version if we don't have an 'extra' argument

2010-04-17 Thread Yvo Schubbe
Log message for revision 111014:
  - no need to use the Test version if we don't have an 'extra' argument

Changed:
  U   Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/functional.py

-=-
Modified: Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/functional.py
===
--- Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/functional.py   
2010-04-17 09:04:22 UTC (rev 111013)
+++ Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/functional.py   
2010-04-17 09:09:09 UTC (rev 111014)
@@ -122,7 +122,7 @@
 import rfc822
 from cStringIO import StringIO
 from ZPublisher.Response import Response
-from ZPublisher.Test import publish_module
+from ZPublisher.Publish import publish_module
 
 # Commit work done by previous python code.
 transaction.commit()

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/ZPublisher/tests/ - backported functional tests for exception handling from trunk

2010-04-16 Thread Yvo Schubbe
Log message for revision 110964:
  - backported functional tests for exception handling from trunk

Changed:
  A   Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt
  A   Zope/branches/2.12/src/ZPublisher/tests/test_exception_handling.py

-=-
Copied: Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt (from 
rev 110963, Zope/trunk/src/ZPublisher/tests/exception_handling.txt)
===
--- Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
(rev 0)
+++ Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-16 10:16:47 UTC (rev 110964)
@@ -0,0 +1,158 @@
+Exception handling
+--
+
+These tests capture the current behavior. Maybe some of that behavior should
+be changed. The behavior caused by handleErrors=False shows only up in tests.
+
+
+Create the browser object we'll be using.
+
+ from Products.Five.testbrowser import Browser
+ browser = Browser()
+ # XXX: browser has no API for disabling redirects
+ browser.mech_browser.set_handle_redirect(False)
+
+Create the objects that are raising exceptions.
+ 
+ dummy = app.test_folder_1_._setObject('foo', ExceptionRaiser1())
+ dummy = app.test_folder_1_._setObject('bar', ExceptionRaiser2())
+
+Handle AttributeError.
+
+ app.test_folder_1_.foo.exception = AttributeError('ERROR VALUE')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 500: Internal Server Error
+ 'Error Type: AttributeError' in browser.contents
+True
+ 'Error Value: ERROR VALUE' in browser.contents
+True
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+AttributeError: ERROR VALUE
+
+Handle ImportError.
+
+ app.test_folder_1_.foo.exception = ImportError('ERROR VALUE')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 500: Internal Server Error
+ 'Error Type: ImportError' in browser.contents
+True
+ 'Error Value: ERROR VALUE' in browser.contents
+True
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+ImportError: ERROR VALUE
+
+Handle zope.publisher.interfaces.NotFound.
+
+ from zope.publisher.interfaces import NotFound
+ app.test_folder_1_.foo.exception = NotFound('OBJECT','NAME')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 404: Not Found
+ 'Error Type: NotFound' in browser.contents
+True
+ Error Value: Object: 'OBJECT', name: 'NAME' in browser.contents
+True
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+NotFound: Object: 'OBJECT', name: 'NAME'
+
+Don't handle SystemExit, even if handleErrors is True.
+
+ app.test_folder_1_.foo.exception = SystemExit('ERROR VALUE')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+SystemExit: ERROR VALUE
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+SystemExit: ERROR VALUE
+
+Handle zExceptions.Redirect.
+
+ from zExceptions import Redirect
+ app.test_folder_1_.foo.exception = Redirect('LOCATION')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 302: Moved Temporarily
+ browser.contents
+''
+ browser.headers['Location']
+'LOCATION'
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+Redirect: LOCATION
+
+Handle zExceptions.Unauthorized.
+
+ from zExceptions import Unauthorized
+ app.test_folder_1_.foo.exception = Unauthorized('ERROR VALUE')
+
+ browser.handleErrors = True
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+HTTPError: HTTP Error 401: Unauthorized
+ 'Error Type: Unauthorized' in browser.contents
+True
+ 'Error Value: ERROR VALUE' in browser.contents
+True
+
+ browser.handleErrors = False
+ browser.open('http://localhost/test_folder_1_/foo')
+Traceback (most recent call last):
+...
+Unauthorized: ERROR VALUE
+
+Handle zExceptions.Forbidden in BaseRequest.traverse. 'traverse' converts it
+into 

[Zope-Checkins] SVN: Zope/branches/2.12/ fixed regression in Unauthorized handling:

2010-04-16 Thread Yvo Schubbe
Log message for revision 110974:
  fixed regression in Unauthorized handling:
  
  In previous Zope versions string exceptions were used and all exceptions
  re-raised. This doesn't work with each kind of exception, but we can still do
  it with Unauthorized exceptions. This way the special handling for 
Unauthorized
  exceptions works again, HTTPResponse._unauthorized is called again. This is 
now
  done after rendering to make sure we don't break logging and custom views.

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt
  UU  Zope/branches/2.12/src/Zope2/App/startup.py
  UU  Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-04-16 14:34:54 UTC (rev 110973)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-04-16 14:47:34 UTC (rev 110974)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++
 
+- LP #372632, comments #15ff.: Fixed regression in Unauthorized handling.
+
 - LP #563229:  Process evil JSON cookies which contain double quotes in
   violation of RFC 2965 / 2616.
 

Modified: Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt
===
--- Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-16 14:34:54 UTC (rev 110973)
+++ Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt  
2010-04-16 14:47:34 UTC (rev 110974)
@@ -115,7 +115,8 @@
 ...
 Redirect: LOCATION
 
-Handle zExceptions.Unauthorized.
+Handle zExceptions.Unauthorized. We take the 'WWW-Authenticate' header as a
+sign that HTTPResponse._unauthorized was called.
 
  from zExceptions import Unauthorized
  app.test_folder_1_.foo.exception = Unauthorized('ERROR VALUE')
@@ -129,6 +130,8 @@
 True
  'Error Value: ERROR VALUE' in browser.contents
 True
+ browser.headers['WWW-Authenticate']
+'basic realm=Zope2'
 
  browser.handleErrors = False
  browser.open('http://localhost/test_folder_1_/foo')

Modified: Zope/branches/2.12/src/Zope2/App/startup.py
===
--- Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-16 14:34:54 UTC (rev 
110973)
+++ Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-16 14:47:34 UTC (rev 
110974)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 Initialize the Zope2 Package and provide a published module
@@ -23,14 +23,12 @@
 from Acquisition.interfaces import IAcquirer
 from App.config import getConfiguration
 from time import asctime
-from types import StringType, ListType
 from zExceptions import upgradeException
 from zExceptions import Redirect
 from zExceptions import Unauthorized
 from ZODB.POSException import ConflictError
 import transaction
 import AccessControl.User
-import App.FindHomes
 import ExtensionClass
 import imp
 import logging
@@ -206,7 +204,7 @@
 # raise the rendered value as the exception value
 # (basically the same that 'raise_standardErrorMessage'
 # does. The view is named 'index.html' because that's what
-# Zope 3 uses as well.
+# zope.publisher uses as well.
 view = queryMultiAdapter((v, REQUEST), name=u'index.html')
 if view is not None:
 if IAcquirer.providedBy(view) and 
IAcquirer.providedBy(published):
@@ -214,13 +212,19 @@
 else:
 view.__parent__ = published
 v = view()
+if issubclass(t, Unauthorized):
+# Re-raise Unauthorized to make sure it is handled
+# correctly. We can't do that with all exceptions
+# because some don't work with the rendered v as
+# argument.
+raise t, v, traceback
 response = REQUEST.RESPONSE
 response.setStatus(t)
 response.setBody(v)
 return response
 
 if (published is None or published is app or
-type(published) is ListType):
+isinstance(published, list)):
 # At least get the top-level object
 published=app.__bobo_traverse__(REQUEST).__of__(
 RequestContainer(REQUEST))
@@ -254,12 +258,18 @@
error_log_url=error_log_url)
 if result is not None:
 t, v, traceback = result
+if issubclass(t, Unauthorized):
+ 

[Zope-Checkins] SVN: Zope/trunk/src/Z fixed regression in Unauthorized handling:

2010-04-16 Thread Yvo Schubbe
Log message for revision 110976:
  fixed regression in Unauthorized handling:
  
  In previous Zope versions string exceptions were used and all exceptions
  re-raised. This doesn't work with each kind of exception, but we can still do
  it with Unauthorized exceptions. This way the special handling for 
Unauthorized
  exceptions works again, HTTPResponse._unauthorized is called again. This is 
now
  done after rendering to make sure we don't break logging and custom views.

Changed:
  U   Zope/trunk/src/ZPublisher/tests/exception_handling.txt
  UU  Zope/trunk/src/Zope2/App/startup.py
  UU  Zope/trunk/src/Zope2/App/tests/testExceptionHook.py

-=-
Modified: Zope/trunk/src/ZPublisher/tests/exception_handling.txt
===
--- Zope/trunk/src/ZPublisher/tests/exception_handling.txt  2010-04-16 
14:47:52 UTC (rev 110975)
+++ Zope/trunk/src/ZPublisher/tests/exception_handling.txt  2010-04-16 
14:48:19 UTC (rev 110976)
@@ -121,7 +121,8 @@
 Redirect: LOCATION
  browser.contents
 
-Handle zExceptions.Unauthorized.
+Handle zExceptions.Unauthorized. We take the 'WWW-Authenticate' header as a
+sign that HTTPResponse._unauthorized was called.
 
  from zExceptions import Unauthorized
  app.test_folder_1_.foo.exception = Unauthorized('ERROR VALUE')
@@ -135,6 +136,8 @@
 True
  'Error Value: ERROR VALUE' in browser.contents
 True
+ browser.headers['WWW-Authenticate']
+'basic realm=Zope2'
 
  browser.handleErrors = False
  browser.open('http://localhost/test_folder_1_/foo')

Modified: Zope/trunk/src/Zope2/App/startup.py
===
--- Zope/trunk/src/Zope2/App/startup.py 2010-04-16 14:47:52 UTC (rev 110975)
+++ Zope/trunk/src/Zope2/App/startup.py 2010-04-16 14:48:19 UTC (rev 110976)
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##
 Initialize the Zope2 Package and provide a published module
@@ -29,10 +29,10 @@
 from time import asctime
 from zExceptions import upgradeException
 from zExceptions import Redirect
+from zExceptions import Unauthorized
 from ZODB.POSException import ConflictError
 import transaction
 import AccessControl.User
-import App.FindHomes
 import ExtensionClass
 import imp
 import logging
@@ -224,6 +224,12 @@
 else:
 view.__parent__ = published
 v = view()
+if issubclass(t, Unauthorized):
+# Re-raise Unauthorized to make sure it is handled
+# correctly. We can't do that with all exceptions
+# because some don't work with the rendered v as
+# argument.
+raise t, v, traceback
 response = REQUEST.RESPONSE
 response.setStatus(t)
 response.setBody(v)
@@ -264,12 +270,18 @@
error_log_url=error_log_url)
 if result is not None:
 t, v, traceback = result
+if issubclass(t, Unauthorized):
+# Re-raise Unauthorized to make sure it is handled
+# correctly. We can't do that with all exceptions
+# because some don't work with the rendered v as
+# argument.
+raise t, v, traceback
 response = REQUEST.RESPONSE
 response.setStatus(t)
 response.setBody(v)
 return response
 except TypeError:
-# Pre 2.6 call signature
+# BBB: Pre Zope 2.6 call signature
 f(client, REQUEST, t, v, traceback)
 
 finally:


Property changes on: Zope/trunk/src/Zope2/App/startup.py
___
Deleted: cvs2svn:cvs-rev
   - 1.15
Added: svn:keywords
   + Id

Modified: Zope/trunk/src/Zope2/App/tests/testExceptionHook.py
===
--- Zope/trunk/src/Zope2/App/tests/testExceptionHook.py 2010-04-16 14:47:52 UTC 
(rev 110975)
+++ Zope/trunk/src/Zope2/App/tests/testExceptionHook.py 2010-04-16 14:48:19 UTC 
(rev 110976)
@@ -347,7 +347,6 @@
 class ExceptionViewsTest(PlacelessSetup, ExceptionHookTestCase):
 
 def testCustomExceptionViewUnauthorized(self):
-from ZPublisher.HTTPResponse import HTTPResponse
 from AccessControl import Unauthorized
 registerExceptionView(IUnauthorized)
 def f():
@@ -355,8 +354,7 @@
 request = self._makeRequest()
 client = 

[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/Publish.py simplified code: 'except SystemExit' and 'except ImportError' do the same.

2010-04-14 Thread Yvo Schubbe
Log message for revision 110896:
  simplified code: 'except SystemExit' and 'except ImportError' do the same.
  It is very unlikely that v is a tuple and 'hasattr(sys, 'exc_info')' is 
always true.

Changed:
  UU  Zope/trunk/src/ZPublisher/Publish.py

-=-
Modified: Zope/trunk/src/ZPublisher/Publish.py
===
--- Zope/trunk/src/ZPublisher/Publish.py2010-04-14 14:14:11 UTC (rev 
110895)
+++ Zope/trunk/src/ZPublisher/Publish.py2010-04-14 14:17:20 UTC (rev 
110896)
@@ -236,17 +236,12 @@
 setDefaultSkin(request)
 
 response = publish(request, module_name, after_list, debug=debug)
-except SystemExit, v:
-must_die=sys.exc_info()
-request.response.exception(must_die)
-except ImportError, v:
-if isinstance(v, tuple) and len(v)==3: must_die=v
-elif hasattr(sys, 'exc_info'): must_die=sys.exc_info()
-else: must_die = SystemExit, v, sys.exc_info()[2]
-request.response.exception(1, v)
+except (SystemExit, ImportError):
+must_die = sys.exc_info()
+request.response.exception(1)
 except:
 request.response.exception()
-status=response.getStatus()
+status = response.getStatus()
 
 if response:
 outputBody=getattr(response, 'outputBody', None)


Property changes on: Zope/trunk/src/ZPublisher/Publish.py
___
Deleted: cvs2svn:cvs-rev
   - 1.167

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


  1   2   >