[Zope-Checkins] Re: [Checkins] SVN: Products.Five/trunk/ Now you can use the old registry with the new API for registerig components.

2006-07-28 Thread Florent Guillaume

On 27 Jul 2006, at 16:15, Lennart Regebro wrote:

Modified: Products.Five/trunk/site/localsite.py
===
--- Products.Five/trunk/site/localsite.py	2006-07-27 13:51:25 UTC  
(rev 69270)
+++ Products.Five/trunk/site/localsite.py	2006-07-27 14:15:46 UTC  
(rev 69271)

@@ -16,12 +16,26 @@
 $Id$
 

+from operator import xor
+def one_of_three(a, b, c):
+# Logical table for a three part test where only one can be true:
+# 0 0 0: 0
+# 0 0 1: 1
+# 0 1 0: 1
+# 0 1 1: 0
+# 1 0 0: 1
+# 1 0 1: 0
+# 1 1 0: 0
+# 1 1 1: 0
+return xor(xor(a, b), c) and not (a and b and c)


Heh, boolean algebra is nice but sometimes integers convey the  
meaning much better:

  return int(a)+int(b)+int(c) == 1

Florent

--
Florent Guillaume, Nuxeo (Paris, France)   Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]



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


[Zope-Checkins] Re: [Checkins] SVN: Products.Five/trunk/ Now you can use the old registry with the new API for registerig components.

2006-07-28 Thread Florent Guillaume

Indeed :)


On 29 Jul 2006, at 00:39, Benji York wrote:


Florent Guillaume wrote:

On 27 Jul 2006, at 16:15, Lennart Regebro wrote:

Modified: Products.Five/trunk/site/localsite.py
===
--- Products.Five/trunk/site/localsite.py	2006-07-27 13:51:25  
UTC  (rev 69270)
+++ Products.Five/trunk/site/localsite.py	2006-07-27 14:15:46  
UTC  (rev 69271)

@@ -16,12 +16,26 @@
$Id$


+from operator import xor
+def one_of_three(a, b, c):
+# Logical table for a three part test where only one can be  
true:

+# 0 0 0: 0
+# 0 0 1: 1
+# 0 1 0: 1
+# 0 1 1: 0
+# 1 0 0: 1
+# 1 0 1: 0
+# 1 1 0: 0
+# 1 1 1: 0
+return xor(xor(a, b), c) and not (a and b and c)
Heh, boolean algebra is nice but sometimes integers convey the   
meaning much better:

   return int(a)+int(b)+int(c) == 1


Hey, this is fun!  How about this:

def only_one(*args):
return sum(bool(i) for i in args) == 1
--
Benji York
Senior Software Engineer
Zope Corporation


--
Florent Guillaume, Nuxeo (Paris, France)   Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]



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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/OFS/Traversable.py Correct view traversal security checks

2006-07-06 Thread Florent Guillaume
Log message for revision 69002:
  Correct view traversal security checks

Changed:
  U   Zope/branches/2.10/lib/python/OFS/Traversable.py

-=-
Modified: Zope/branches/2.10/lib/python/OFS/Traversable.py
===
--- Zope/branches/2.10/lib/python/OFS/Traversable.py2006-07-06 04:15:00 UTC 
(rev 69001)
+++ Zope/branches/2.10/lib/python/OFS/Traversable.py2006-07-06 13:44:01 UTC 
(rev 69002)
@@ -260,6 +260,10 @@
 
 if next is not None:
 next = next.__of__(obj)
+if restricted:
+if not securityManager.validate(
+obj, obj, name, next):
+raise Unauthorized, name
 elif bobo_traverse is not None:
 # Attribute lookup should not be done after 
 # __bobo_traverse__:

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/Traversable.py Merged 69002 from 2.10 branch:

2006-07-06 Thread Florent Guillaume
Log message for revision 69003:
  Merged 69002 from 2.10 branch:
Correct view traversal security checks
  

Changed:
  U   Zope/trunk/lib/python/OFS/Traversable.py

-=-
Modified: Zope/trunk/lib/python/OFS/Traversable.py
===
--- Zope/trunk/lib/python/OFS/Traversable.py2006-07-06 13:44:01 UTC (rev 
69002)
+++ Zope/trunk/lib/python/OFS/Traversable.py2006-07-06 13:45:15 UTC (rev 
69003)
@@ -260,6 +260,10 @@
 
 if next is not None:
 next = next.__of__(obj)
+if restricted:
+if not securityManager.validate(
+obj, obj, name, next):
+raise Unauthorized, name
 elif bobo_traverse is not None:
 # Attribute lookup should not be done after 
 # __bobo_traverse__:

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/OFS/Traversable.py Code cleanup.

2006-07-06 Thread Florent Guillaume
Log message for revision 69004:
  Code cleanup.
  

Changed:
  U   Zope/branches/2.10/lib/python/OFS/Traversable.py

-=-
Modified: Zope/branches/2.10/lib/python/OFS/Traversable.py
===
--- Zope/branches/2.10/lib/python/OFS/Traversable.py2006-07-06 13:45:15 UTC 
(rev 69003)
+++ Zope/branches/2.10/lib/python/OFS/Traversable.py2006-07-06 14:24:13 UTC 
(rev 69004)
@@ -118,7 +118,7 @@
 return path
 
 security.declarePrivate('unrestrictedTraverse')
-def unrestrictedTraverse(self, path, default=_marker, restricted=0):
+def unrestrictedTraverse(self, path, default=_marker, restricted=False):
 Lookup an object by path.
 
 path -- The path to the object. May be a sequence of strings or a slash
@@ -139,10 +139,6 @@
 if not path:
 return self
 
-_getattr = getattr
-_none = None
-marker = _marker
-
 if isinstance(path, str):
 # Unicode paths are not allowed
 path = path.split('/')
@@ -151,27 +147,25 @@
 
 REQUEST = {'TraversalRequestNameStack': path}
 path.reverse()
-path_pop=path.pop
+path_pop = path.pop
 
 if len(path)  1 and not path[0]:
 # Remove trailing slash
-path.pop(0)
+path_pop(0)
 
 if restricted:
-securityManager = getSecurityManager()
-else:
-securityManager = _none
+validate = getSecurityManager().validate
 
 if not path[-1]:
 # If the path starts with an empty string, go to the root first.
 path_pop()
-self = self.getPhysicalRoot()
-if (restricted
-and not securityManager.validate(None, None, None, self)):
-raise Unauthorized, name
+obj = self.getPhysicalRoot()
+if restricted and not validate(None, None, None, obj):
+raise Unauthorized(name)
+else:
+obj = self
 
 try:
-obj = self
 while path:
 name = path_pop()
 __traceback_info__ = path, name
@@ -182,102 +176,98 @@
 
 if name == '..':
 next = aq_parent(obj)
-if next is not _none:
-if restricted and not securityManager.validate(
-obj, obj,name, next):
-raise Unauthorized, name
+if next is not None:
+if restricted and not validate(obj, obj, name, next):
+raise Unauthorized(name)
 obj = next
 continue
 
-bobo_traverse = _getattr(obj, '__bobo_traverse__', _none)
+bobo_traverse = getattr(obj, '__bobo_traverse__', None)
 try:
 if name and name[:1] in '@+':
 # Process URI segment parameters.
 ns, nm = nsParse(name)
 if ns:
 try:
-next = namespaceLookup(ns, nm, obj, 
-   
self.REQUEST).__of__(obj)
-if restricted and not securityManager.validate(
+next = namespaceLookup(
+ns, nm, obj, self.REQUEST).__of__(obj)
+if restricted and not validate(
 obj, obj, name, next):
-raise Unauthorized, name
+raise Unauthorized(name)
 except TraversalError:
 raise AttributeError(name)
-elif bobo_traverse is not _none:
+elif bobo_traverse is not None:
 next = bobo_traverse(REQUEST, name)
 if restricted:
 if aq_base(next) is not next:
 # The object is wrapped, so the acquisition
 # context is the container.
 container = aq_parent(aq_inner(next))
-elif _getattr(next, 'im_self', _none) is not _none:
+elif getattr(next, 'im_self', None) is not None:
 # Bound method, the bound instance
 # is the container
 container = next.im_self
-elif _getattr(aq_base(obj), name, marker) == next:
+elif getattr(aq_base(obj), name, _marker) is next:
 # Unwrapped direct attribute of the object so
 # object is the 

[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/Traversable.py Code cleanup.

2006-07-06 Thread Florent Guillaume
Log message for revision 69005:
  Code cleanup.

Changed:
  U   Zope/trunk/lib/python/OFS/Traversable.py

-=-
Modified: Zope/trunk/lib/python/OFS/Traversable.py
===
--- Zope/trunk/lib/python/OFS/Traversable.py2006-07-06 14:24:13 UTC (rev 
69004)
+++ Zope/trunk/lib/python/OFS/Traversable.py2006-07-06 14:25:04 UTC (rev 
69005)
@@ -118,7 +118,7 @@
 return path
 
 security.declarePrivate('unrestrictedTraverse')
-def unrestrictedTraverse(self, path, default=_marker, restricted=0):
+def unrestrictedTraverse(self, path, default=_marker, restricted=False):
 Lookup an object by path.
 
 path -- The path to the object. May be a sequence of strings or a slash
@@ -139,10 +139,6 @@
 if not path:
 return self
 
-_getattr = getattr
-_none = None
-marker = _marker
-
 if isinstance(path, str):
 # Unicode paths are not allowed
 path = path.split('/')
@@ -151,27 +147,25 @@
 
 REQUEST = {'TraversalRequestNameStack': path}
 path.reverse()
-path_pop=path.pop
+path_pop = path.pop
 
 if len(path)  1 and not path[0]:
 # Remove trailing slash
-path.pop(0)
+path_pop(0)
 
 if restricted:
-securityManager = getSecurityManager()
-else:
-securityManager = _none
+validate = getSecurityManager().validate
 
 if not path[-1]:
 # If the path starts with an empty string, go to the root first.
 path_pop()
-self = self.getPhysicalRoot()
-if (restricted
-and not securityManager.validate(None, None, None, self)):
-raise Unauthorized, name
+obj = self.getPhysicalRoot()
+if restricted and not validate(None, None, None, obj):
+raise Unauthorized(name)
+else:
+obj = self
 
 try:
-obj = self
 while path:
 name = path_pop()
 __traceback_info__ = path, name
@@ -182,102 +176,98 @@
 
 if name == '..':
 next = aq_parent(obj)
-if next is not _none:
-if restricted and not securityManager.validate(
-obj, obj,name, next):
-raise Unauthorized, name
+if next is not None:
+if restricted and not validate(obj, obj, name, next):
+raise Unauthorized(name)
 obj = next
 continue
 
-bobo_traverse = _getattr(obj, '__bobo_traverse__', _none)
+bobo_traverse = getattr(obj, '__bobo_traverse__', None)
 try:
 if name and name[:1] in '@+':
 # Process URI segment parameters.
 ns, nm = nsParse(name)
 if ns:
 try:
-next = namespaceLookup(ns, nm, obj, 
-   
self.REQUEST).__of__(obj)
-if restricted and not securityManager.validate(
+next = namespaceLookup(
+ns, nm, obj, self.REQUEST).__of__(obj)
+if restricted and not validate(
 obj, obj, name, next):
-raise Unauthorized, name
+raise Unauthorized(name)
 except TraversalError:
 raise AttributeError(name)
-elif bobo_traverse is not _none:
+elif bobo_traverse is not None:
 next = bobo_traverse(REQUEST, name)
 if restricted:
 if aq_base(next) is not next:
 # The object is wrapped, so the acquisition
 # context is the container.
 container = aq_parent(aq_inner(next))
-elif _getattr(next, 'im_self', _none) is not _none:
+elif getattr(next, 'im_self', None) is not None:
 # Bound method, the bound instance
 # is the container
 container = next.im_self
-elif _getattr(aq_base(obj), name, marker) == next:
+elif getattr(aq_base(obj), name, _marker) is next:
 # Unwrapped direct attribute of the object so
 # object is the container
 

[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/OFS/ Fixed refactored traversal on bound methods of classes with no default

2006-07-05 Thread Florent Guillaume
Log message for revision 68980:
  Fixed refactored traversal on bound methods of classes with no default
  access.
  

Changed:
  U   Zope/branches/2.10/lib/python/OFS/Traversable.py
  U   Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py

-=-
Modified: Zope/branches/2.10/lib/python/OFS/Traversable.py
===
--- Zope/branches/2.10/lib/python/OFS/Traversable.py2006-07-05 16:13:42 UTC 
(rev 68979)
+++ Zope/branches/2.10/lib/python/OFS/Traversable.py2006-07-05 16:53:20 UTC 
(rev 68980)
@@ -237,11 +237,11 @@
 if not validated:
 raise Unauthorized, name
 else:
-if hasattr(aq_base(obj), name):
+if getattr(aq_base(obj), name, marker) is not marker:
 if restricted:
-next = guarded_getattr(obj, name, marker)
+next = guarded_getattr(obj, name)
 else:
-next = _getattr(obj, name, marker)
+next = _getattr(obj, name)
 else:
 try:
 next=obj[name]
@@ -249,6 +249,9 @@
 # Raise NotFound for easier debugging
 # instead of AttributeError: __getitem__
 raise NotFound, name
+if restricted and not securityManager.validate(
+obj, obj, _none, next):
+raise Unauthorized, name
 
 except (AttributeError, NotFound, KeyError), e: 
 # Try to look for a view
@@ -270,13 +273,10 @@
 next = _getattr(obj, name, marker)
 except AttributeError:
 raise e
-if next is marker:
-# Nothing found re-raise error
-raise e
-
-if restricted and not securityManager.validate(
-obj, obj, _none, next):
-raise Unauthorized, name
+if next is marker:
+# Nothing found re-raise error
+raise e
+
 obj = next
 
 return obj

Modified: Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py
===
--- Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py 2006-07-05 
16:13:42 UTC (rev 68979)
+++ Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py 2006-07-05 
16:53:20 UTC (rev 68980)
@@ -68,6 +68,24 @@
 return 0
 
 
+class ProtectedMethodSecurityPolicy:
+Check security strictly on bound methods.
+
+def validate(self, accessed, container, name, value, *args):
+if getattr(aq_base(value), 'im_self', None) is None:
+return 1
+
+# Bound method
+if name is None:
+raise Unauthorized
+klass = value.im_self.__class__
+roles = getattr(klass, name+'__roles__', object())
+if roles is None: # ACCESS_PUBLIC
+return 1
+
+raise Unauthorized(name)
+
+
 class UnitTestUser( Acquisition.Implicit ):
 
 Stubbed out manager for unit testing purposes.
@@ -103,6 +121,22 @@
 bb_status = 'screechy'
 
 
+class Restricted(SimpleItem):
+Instance we'll check with ProtectedMethodSecurityPolicy
+
+getId__roles__ = None # ACCESS_PUBLIC
+def getId(self):
+return self.id
+
+private__roles__ = () # ACCESS_PRIVATE
+def private(self):
+return 'private!'
+
+# not protected
+def ohno(self):
+return 'ohno!'
+
+
 class BoboTraversableWithAcquisition(SimpleItem):
 
A BoboTraversable class which may use acquisition to find objects.
@@ -210,6 +244,17 @@
 self.failUnlessRaises(
 KeyError, self.folder1.unrestrictedTraverse,  '/folder1/file2/' )
 
+def testTraverseMethodRestricted(self):
+self.root.my = Restricted('my')
+my = self.root.my
+my.id = 'my'
+noSecurityManager()
+SecurityManager.setSecurityPolicy(ProtectedMethodSecurityPolicy())
+r = my.restrictedTraverse('getId')
+self.assertEquals(r(), 'my')
+self.assertRaises(Unauthorized, my.restrictedTraverse, 'private')
+self.assertRaises(Unauthorized, my.restrictedTraverse, 'ohno')
+
 def testBoboTraverseToWrappedSubObj(self):
 # Verify it's possible to use __bobo_traverse__ with the
 # Zope security policy.

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


[Zope-Checkins] SVN: Zope/branches/2.10/ Acquisition wrappers now correctly proxy __contains__.

2006-06-02 Thread Florent Guillaume
Log message for revision 68458:
  Acquisition wrappers now correctly proxy __contains__.
  
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/Acquisition/_Acquisition.c
  U   Zope/branches/2.10/lib/python/Acquisition/tests.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===
--- Zope/branches/2.10/doc/CHANGES.txt  2006-06-02 11:03:06 UTC (rev 68457)
+++ Zope/branches/2.10/doc/CHANGES.txt  2006-06-02 14:24:46 UTC (rev 68458)
@@ -14,6 +14,12 @@
  to the rules for such a type laid out in the Python docs:
  http://docs.python.org/api/supporting-cycle-detection.html
 
+  After Zope 2.10 beta 1
+
+Bugs Fixed
+
+  - Acquisition wrappers now correctly proxy __contains__.
+
   Zope 2.10 beta 1 (2006/05/30)
 
 Restructuring

Modified: Zope/branches/2.10/lib/python/Acquisition/_Acquisition.c
===
--- Zope/branches/2.10/lib/python/Acquisition/_Acquisition.c2006-06-02 
11:03:06 UTC (rev 68457)
+++ Zope/branches/2.10/lib/python/Acquisition/_Acquisition.c2006-06-02 
14:24:46 UTC (rev 68458)
@@ -37,7 +37,7 @@
   *py__pos__, *py__abs__, *py__nonzero__, *py__invert__, *py__int__,
   *py__long__, *py__float__, *py__oct__, *py__hex__,
   *py__getitem__, *py__setitem__, *py__delitem__,
-  *py__getslice__, *py__setslice__, *py__delslice__,
+  *py__getslice__, *py__setslice__, *py__delslice__,  *py__contains__,
   *py__len__, *py__of__, *py__call__, *py__repr__, *py__str__, *py__cmp__;
 
 static PyObject *Acquired=0;
@@ -75,6 +75,7 @@
   INIT_PY_NAME(__getslice__);
   INIT_PY_NAME(__setslice__);
   INIT_PY_NAME(__delslice__);
+  INIT_PY_NAME(__contains__);
   INIT_PY_NAME(__len__);
   INIT_PY_NAME(__of__);
   INIT_PY_NAME(__call__);
@@ -804,6 +805,18 @@
   return 0;
 }
 
+static int
+Wrapper_contains(Wrapper *self, PyObject *v)
+{
+  long c;
+
+  UNLESS(v=CallMethodO(OBJECT(self),py__contains__,Build((O), v) ,NULL))
+return -1;
+  c = PyInt_AsLong(v);
+  Py_DECREF(v);
+  return c;
+}
+
 static PySequenceMethods Wrapper_as_sequence = {
(inquiry)Wrapper_length,/*sq_length*/
(binaryfunc)Wrapper_add,/*sq_concat*/
@@ -812,6 +825,7 @@
(intintargfunc)Wrapper_slice,   /*sq_slice*/
(intobjargproc)Wrapper_ass_item,/*sq_ass_item*/
(intintobjargproc)Wrapper_ass_slice,/*sq_ass_slice*/
+   (objobjproc)Wrapper_contains,   /*sq_contains*/
 };
 
 /* -- */

Modified: Zope/branches/2.10/lib/python/Acquisition/tests.py
===
--- Zope/branches/2.10/lib/python/Acquisition/tests.py  2006-06-02 11:03:06 UTC 
(rev 68457)
+++ Zope/branches/2.10/lib/python/Acquisition/tests.py  2006-06-02 14:24:46 UTC 
(rev 68458)
@@ -1620,8 +1620,50 @@
 
 
 
-
+def test_proxying():
+Make sure that recent python slots are proxied.
 
+ import Acquisition
+ class Impl(Acquisition.Implicit):
+... pass
+
+ class C(Acquisition.Implicit):
+... def __getitem__(self, key):
+... print 'getitem', key
+... if key == 4:
+... raise IndexError
+... return key
+... def __contains__(self, key):
+... print 'contains', repr(key)
+... return key == 5
+
+The naked class behaves like this:
+
+ c = C()
+ 3 in c
+contains 3
+False
+ 5 in c
+contains 5
+True
+
+Let's put c in the context of i:
+
+ i = Impl()
+ i.c = c
+
+Now check that __contains__ is properly used:
+
+ 3 in i.c # c.__of__(i)
+contains 3
+False
+ 5 in i.c
+contains 5
+True
+
+
+
+
 import unittest
 from zope.testing.doctest import DocTestSuite
 

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


[Zope-Checkins] SVN: Zope/branches/2.10/doc/CHANGES.txt Sync formatting with trunk.

2006-06-02 Thread Florent Guillaume
Log message for revision 68460:
  Sync formatting with trunk.
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===
--- Zope/branches/2.10/doc/CHANGES.txt  2006-06-02 14:34:52 UTC (rev 68459)
+++ Zope/branches/2.10/doc/CHANGES.txt  2006-06-02 14:38:06 UTC (rev 68460)
@@ -14,13 +14,13 @@
  to the rules for such a type laid out in the Python docs:
  http://docs.python.org/api/supporting-cycle-detection.html
 
-  After Zope 2.10 beta 1
+  Zope 2.10.0 beta 2 (unreleased)
 
 Bugs Fixed
 
   - Acquisition wrappers now correctly proxy __contains__.
 
-  Zope 2.10 beta 1 (2006/05/30)
+  Zope 2.10.0 beta 1 (2006/05/30)
 
 Restructuring
 

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PageTemplates/ Empty TALES path expressions are allowed in Zope 2.

2006-06-02 Thread Florent Guillaume
Log message for revision 68461:
  Empty TALES path expressions are allowed in Zope 2.
  http://www.zope.org/Collectors/Zope/2118
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
  U   
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
===
--- Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 
2006-06-02 14:38:06 UTC (rev 68460)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 
2006-06-02 15:02:15 UTC (rev 68461)
@@ -99,6 +99,8 @@
 class ZopePathExpr(PathExpr):
 
 def __init__(self, name, expr, engine):
+if not expr.strip():
+expr = 'nothing'
 super(ZopePathExpr, self).__init__(name, expr, engine,
boboAwareZopeTraverse)
 

Modified: 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py
===
--- 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py   
2006-06-02 14:38:06 UTC (rev 68460)
+++ 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py   
2006-06-02 15:02:15 UTC (rev 68461)
@@ -86,6 +86,15 @@
 self.failUnless(isinstance(defer, DeferWrapper))
 self.failUnless(isinstance(lazy, LazyWrapper))
 
+def test_empty_ZopePathExpr(self):
+Test empty path expressions.
+
+ec = self.ec
+self.assertEquals(ec.evaluate('path:'), None)
+self.assertEquals(ec.evaluate('path:  '), None)
+self.assertEquals(ec.evaluate(''), None)
+self.assertEquals(ec.evaluate('  \n'), None)
+
 def test_suite():
 return unittest.makeSuite(ExpressionTests)
 

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/ Merged r68461 from 2.10 branch:

2006-06-02 Thread Florent Guillaume
Log message for revision 68462:
  Merged r68461 from 2.10 branch:
Empty TALES path expressions are allowed in Zope 2.
http://www.zope.org/Collectors/Zope/2118
  

Changed:
  U   Zope/trunk/lib/python/Products/PageTemplates/Expressions.py
  U   Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py

-=-
Modified: Zope/trunk/lib/python/Products/PageTemplates/Expressions.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2006-06-02 
15:02:15 UTC (rev 68461)
+++ Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2006-06-02 
15:04:12 UTC (rev 68462)
@@ -99,6 +99,8 @@
 class ZopePathExpr(PathExpr):
 
 def __init__(self, name, expr, engine):
+if not expr.strip():
+expr = 'nothing'
 super(ZopePathExpr, self).__init__(name, expr, engine,
boboAwareZopeTraverse)
 

Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py   
2006-06-02 15:02:15 UTC (rev 68461)
+++ Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py   
2006-06-02 15:04:12 UTC (rev 68462)
@@ -86,6 +86,15 @@
 self.failUnless(isinstance(defer, DeferWrapper))
 self.failUnless(isinstance(lazy, LazyWrapper))
 
+def test_empty_ZopePathExpr(self):
+Test empty path expressions.
+
+ec = self.ec
+self.assertEquals(ec.evaluate('path:'), None)
+self.assertEquals(ec.evaluate('path:  '), None)
+self.assertEquals(ec.evaluate(''), None)
+self.assertEquals(ec.evaluate('  \n'), None)
+
 def test_suite():
 return unittest.makeSuite(ExpressionTests)
 

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ZCatalog/ZCatalog.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68427:
  Removed a warning at Zope startup.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/ZCatalog/ZCatalog.py
===
--- Zope/branches/2.10/lib/python/Products/ZCatalog/ZCatalog.py 2006-06-01 
09:25:43 UTC (rev 68426)
+++ Zope/branches/2.10/lib/python/Products/ZCatalog/ZCatalog.py 2006-06-01 
10:36:10 UTC (rev 68427)
@@ -37,7 +37,6 @@
 from Products.PluginIndexes.common.PluggableIndex \
  import PluggableIndexInterface
 from Products.PluginIndexes.interfaces import IPluggableIndex
-from Products.PluginIndexes.TextIndex import Splitter
 from zope.interface import implements
 
 from Catalog import Catalog, CatalogError
@@ -508,9 +507,12 @@
 '?manage_tabs_message=Reindexing%20Performed')
 
 
+# BBB: will be removed in Zope 2.12 (like TextIndex itself)
 security.declareProtected(manage_zcatalog_entries, 'availableSplitters')
 def availableSplitters(self):
  splitter we can add 
+# This import will trigger a deprecation warning about TextIndex
+from Products.PluginIndexes.TextIndex import Splitter
 return Splitter.availableSplitters
 
 

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py Merged r68427 from 2.10 branch:

2006-06-01 Thread Florent Guillaume
Log message for revision 68428:
  Merged r68427 from 2.10 branch:
  Removed a warning at Zope startup.
  
  

Changed:
  U   Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
===
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py 2006-06-01 10:36:10 UTC 
(rev 68427)
+++ Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py 2006-06-01 10:40:02 UTC 
(rev 68428)
@@ -37,7 +37,6 @@
 from Products.PluginIndexes.common.PluggableIndex \
  import PluggableIndexInterface
 from Products.PluginIndexes.interfaces import IPluggableIndex
-from Products.PluginIndexes.TextIndex import Splitter
 from zope.interface import implements
 
 from Catalog import Catalog, CatalogError
@@ -508,9 +507,12 @@
 '?manage_tabs_message=Reindexing%20Performed')
 
 
+# BBB: will be removed in Zope 2.12 (like TextIndex itself)
 security.declareProtected(manage_zcatalog_entries, 'availableSplitters')
 def availableSplitters(self):
  splitter we can add 
+# This import will trigger a deprecation warning about TextIndex
+from Products.PluginIndexes.TextIndex import Splitter
 return Splitter.availableSplitters
 
 

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68430:
  Removed a warning at Zope startup.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py
===
--- Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py
2006-06-01 10:54:18 UTC (rev 68429)
+++ Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py
2006-06-01 11:48:09 UTC (rev 68430)
@@ -16,13 +16,21 @@
 import common.UnIndexas UnIndex
 
 import PathIndex.PathIndex
-import TextIndex.TextIndex
 import FieldIndex.FieldIndex
 import KeywordIndex.KeywordIndex
 import TopicIndex.TopicIndex
 import DateIndex.DateIndex
 import DateRangeIndex.DateRangeIndex
 
+# BBB: TextIndex is deprecated but we don't want the warning to appear here
+import warnings
+warnings.filterwarnings('ignore', message='^Using TextIndex', append=1)
+try:
+import TextIndex.TextIndex
+finally:
+del warnings.filters[-1]
+del __warningregistry__
+
 _indexes =  ('TextIndex',
  'KeywordIndex',
  'FieldIndex',

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PluginIndexes/__init__.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68431:
  Removed a warning at Zope startup.

Changed:
  U   Zope/trunk/lib/python/Products/PluginIndexes/__init__.py

-=-
Modified: Zope/trunk/lib/python/Products/PluginIndexes/__init__.py
===
--- Zope/trunk/lib/python/Products/PluginIndexes/__init__.py2006-06-01 
11:48:09 UTC (rev 68430)
+++ Zope/trunk/lib/python/Products/PluginIndexes/__init__.py2006-06-01 
11:50:02 UTC (rev 68431)
@@ -16,13 +16,21 @@
 import common.UnIndexas UnIndex
 
 import PathIndex.PathIndex
-import TextIndex.TextIndex
 import FieldIndex.FieldIndex
 import KeywordIndex.KeywordIndex
 import TopicIndex.TopicIndex
 import DateIndex.DateIndex
 import DateRangeIndex.DateRangeIndex
 
+# BBB: TextIndex is deprecated but we don't want the warning to appear here
+import warnings
+warnings.filterwarnings('ignore', message='^Using TextIndex', append=1)
+try:
+import TextIndex.TextIndex
+finally:
+del warnings.filters[-1]
+del __warningregistry__
+
 _indexes =  ('TextIndex',
  'KeywordIndex',
  'FieldIndex',

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68432:
  Removed a warning at Zope startup.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py
===
--- Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py 2006-06-01 
11:50:02 UTC (rev 68431)
+++ Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py 2006-06-01 
11:52:56 UTC (rev 68432)
@@ -15,8 +15,16 @@
 
 import ZCatalog, CatalogAwareness, CatalogPathAwareness
 from Products.PluginIndexes.TextIndex import Vocabulary
-from ZClasses import createZClassForBase
 
+# BBB: ZClasses are deprecated but we don't want the warning to appear here
+import warnings
+warnings.filterwarnings('ignore', message='^ZClasses', append=1)
+try:
+from ZClasses import createZClassForBase
+finally:
+del warnings.filters[-1]
+del __warningregistry__
+
 createZClassForBase( ZCatalog.ZCatalog , globals()
, 'ZCatalogBase', 'ZCatalog' )
 createZClassForBase( CatalogAwareness.CatalogAware, globals()

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZCatalog/__init__.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68433:
  Removed a warning at Zope startup.

Changed:
  U   Zope/trunk/lib/python/Products/ZCatalog/__init__.py

-=-
Modified: Zope/trunk/lib/python/Products/ZCatalog/__init__.py
===
--- Zope/trunk/lib/python/Products/ZCatalog/__init__.py 2006-06-01 11:52:56 UTC 
(rev 68432)
+++ Zope/trunk/lib/python/Products/ZCatalog/__init__.py 2006-06-01 11:53:33 UTC 
(rev 68433)
@@ -15,8 +15,16 @@
 
 import ZCatalog, CatalogAwareness, CatalogPathAwareness
 from Products.PluginIndexes.TextIndex import Vocabulary
-from ZClasses import createZClassForBase
 
+# BBB: ZClasses are deprecated but we don't want the warning to appear here
+import warnings
+warnings.filterwarnings('ignore', message='^ZClasses', append=1)
+try:
+from ZClasses import createZClassForBase
+finally:
+del warnings.filters[-1]
+del __warningregistry__
+
 createZClassForBase( ZCatalog.ZCatalog , globals()
, 'ZCatalogBase', 'ZCatalog' )
 createZClassForBase( CatalogAwareness.CatalogAware, globals()

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py More robust.

2006-06-01 Thread Florent Guillaume
Log message for revision 68434:
  More robust.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py
===
--- Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py 2006-06-01 
11:53:33 UTC (rev 68433)
+++ Zope/branches/2.10/lib/python/Products/ZCatalog/__init__.py 2006-06-01 
11:56:03 UTC (rev 68434)
@@ -23,7 +23,10 @@
 from ZClasses import createZClassForBase
 finally:
 del warnings.filters[-1]
-del __warningregistry__
+try:
+del __warningregistry__
+except NameError:
+pass
 
 createZClassForBase( ZCatalog.ZCatalog , globals()
, 'ZCatalogBase', 'ZCatalog' )

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZCatalog/__init__.py More robust.

2006-06-01 Thread Florent Guillaume
Log message for revision 68435:
  More robust.

Changed:
  U   Zope/trunk/lib/python/Products/ZCatalog/__init__.py

-=-
Modified: Zope/trunk/lib/python/Products/ZCatalog/__init__.py
===
--- Zope/trunk/lib/python/Products/ZCatalog/__init__.py 2006-06-01 11:56:03 UTC 
(rev 68434)
+++ Zope/trunk/lib/python/Products/ZCatalog/__init__.py 2006-06-01 11:56:36 UTC 
(rev 68435)
@@ -23,7 +23,10 @@
 from ZClasses import createZClassForBase
 finally:
 del warnings.filters[-1]
-del __warningregistry__
+try:
+del __warningregistry__
+except NameError:
+pass
 
 createZClassForBase( ZCatalog.ZCatalog , globals()
, 'ZCatalogBase', 'ZCatalog' )

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py More robust.

2006-06-01 Thread Florent Guillaume
Log message for revision 68436:
  More robust.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py
===
--- Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py
2006-06-01 11:56:36 UTC (rev 68435)
+++ Zope/branches/2.10/lib/python/Products/PluginIndexes/__init__.py
2006-06-01 11:56:50 UTC (rev 68436)
@@ -29,7 +29,10 @@
 import TextIndex.TextIndex
 finally:
 del warnings.filters[-1]
-del __warningregistry__
+try:
+del __warningregistry__
+except NameError:
+pass
 
 _indexes =  ('TextIndex',
  'KeywordIndex',

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PluginIndexes/__init__.py More robust.

2006-06-01 Thread Florent Guillaume
Log message for revision 68437:
  More robust.

Changed:
  U   Zope/trunk/lib/python/Products/PluginIndexes/__init__.py

-=-
Modified: Zope/trunk/lib/python/Products/PluginIndexes/__init__.py
===
--- Zope/trunk/lib/python/Products/PluginIndexes/__init__.py2006-06-01 
11:56:50 UTC (rev 68436)
+++ Zope/trunk/lib/python/Products/PluginIndexes/__init__.py2006-06-01 
11:57:17 UTC (rev 68437)
@@ -29,7 +29,10 @@
 import TextIndex.TextIndex
 finally:
 del warnings.filters[-1]
-del __warningregistry__
+try:
+del __warningregistry__
+except NameError:
+pass
 
 _indexes =  ('TextIndex',
  'KeywordIndex',

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/App/Product.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68438:
  Removed a warning at Zope startup.
  

Changed:
  U   Zope/branches/2.10/lib/python/App/Product.py

-=-
Modified: Zope/branches/2.10/lib/python/App/Product.py
===
--- Zope/branches/2.10/lib/python/App/Product.py2006-06-01 11:57:17 UTC 
(rev 68437)
+++ Zope/branches/2.10/lib/python/App/Product.py2006-06-01 11:58:47 UTC 
(rev 68438)
@@ -42,7 +42,7 @@
 
 import Globals, OFS.Folder, OFS.SimpleItem,  Acquisition, Products
 from Globals import InitializeClass
-import ZClasses, AccessControl.Owned
+import AccessControl.Owned
 from OFS.Folder import Folder
 from HelpSys.HelpSys import ProductHelp
 from AccessControl import Unauthorized
@@ -53,6 +53,17 @@
 import RefreshFuncs
 from App.config import getConfiguration
 
+# BBB: ZClasses are deprecated but we don't want the warning to appear here
+import warnings
+warnings.filterwarnings('ignore', message='^ZClasses', append=1)
+try:
+import ZClasses
+finally:
+del warnings.filters[-1]
+try:
+del __warningregistry__
+except NameError:
+pass
 
 class ProductFolder(Folder):
 Manage a collection of Products

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/App/Product.py Removed a warning at Zope startup.

2006-06-01 Thread Florent Guillaume
Log message for revision 68439:
  Removed a warning at Zope startup.

Changed:
  U   Zope/trunk/lib/python/App/Product.py

-=-
Modified: Zope/trunk/lib/python/App/Product.py
===
--- Zope/trunk/lib/python/App/Product.py2006-06-01 11:58:47 UTC (rev 
68438)
+++ Zope/trunk/lib/python/App/Product.py2006-06-01 11:59:22 UTC (rev 
68439)
@@ -42,7 +42,7 @@
 
 import Globals, OFS.Folder, OFS.SimpleItem,  Acquisition, Products
 from Globals import InitializeClass
-import ZClasses, AccessControl.Owned
+import AccessControl.Owned
 from OFS.Folder import Folder
 from HelpSys.HelpSys import ProductHelp
 from AccessControl import Unauthorized
@@ -53,6 +53,17 @@
 import RefreshFuncs
 from App.config import getConfiguration
 
+# BBB: ZClasses are deprecated but we don't want the warning to appear here
+import warnings
+warnings.filterwarnings('ignore', message='^ZClasses', append=1)
+try:
+import ZClasses
+finally:
+del warnings.filters[-1]
+try:
+del __warningregistry__
+except NameError:
+pass
 
 class ProductFolder(Folder):
 Manage a collection of Products

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py Don't warn when the ZGadflyDA is imported by Zope startup code.

2006-06-01 Thread Florent Guillaume
Log message for revision 68440:
  Don't warn when the ZGadflyDA is imported by Zope startup code.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py
===
--- Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py
2006-06-01 11:59:22 UTC (rev 68439)
+++ Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py
2006-06-01 12:17:15 UTC (rev 68440)
@@ -15,11 +15,14 @@
 $Id$
 
 
-import warnings
-warnings.warn('Using Gadfly and ZGadflyDA is deprecated. The module will be '
-  'removed in Zope 2.11)', 
-  DeprecationWarning,
-  stacklevel=2) 
+# Don't warn when the product is imported by the startup code
+import sys
+if sys._getframe(1).f_code.co_name != 'import_product': # OFS.Application
+import warnings
+warnings.warn('Using Gadfly and ZGadflyDA is deprecated. '
+  'The module will be removed in Zope 2.11)',
+  DeprecationWarning,
+  stacklevel=2)
 
 import Globals, os
 

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/ Make python security policy work with a boolean __aatus__

2006-06-01 Thread Florent Guillaume
Log message for revision 68444:
  Make python security policy work with a boolean __aatus__

Changed:
  U   Zope/branches/2.10/lib/python/AccessControl/ImplPython.py
  U   
Zope/branches/2.10/lib/python/AccessControl/tests/testZopeSecurityPolicy.py
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py

-=-
Modified: Zope/branches/2.10/lib/python/AccessControl/ImplPython.py
===
--- Zope/branches/2.10/lib/python/AccessControl/ImplPython.py   2006-06-01 
14:18:32 UTC (rev 68443)
+++ Zope/branches/2.10/lib/python/AccessControl/ImplPython.py   2006-06-01 
14:44:13 UTC (rev 68444)
@@ -318,7 +318,7 @@
 
 if p is not None:
 tp = p.__class__
-if tp is not int:
+if tp is not int and tp is not bool:
 if tp is dict:
 if isinstance(name, basestring):
 p = p.get(name)

Modified: 
Zope/branches/2.10/lib/python/AccessControl/tests/testZopeSecurityPolicy.py
===
--- Zope/branches/2.10/lib/python/AccessControl/tests/testZopeSecurityPolicy.py 
2006-06-01 14:18:32 UTC (rev 68443)
+++ Zope/branches/2.10/lib/python/AccessControl/tests/testZopeSecurityPolicy.py 
2006-06-01 14:44:13 UTC (rev 68444)
@@ -113,6 +113,11 @@
 __allow_access_to_unprotected_subobjects__ = 1
 
 
+class UnprotectedSimpleItemBool (SimpleItemish):
+
+__allow_access_to_unprotected_subobjects__ = True
+
+
 class OwnedSimpleItem(UnprotectedSimpleItem):
 def getOwner(self, info=0):
 if info:
@@ -159,6 +164,7 @@
 a = App()
 self.a = a
 a.item = UnprotectedSimpleItem()
+a.itemb = UnprotectedSimpleItemBool()
 self.item = a.item
 a.r_item = RestrictedSimpleItem()
 a.item1 = PartlyProtectedSimpleItem1()
@@ -237,11 +243,13 @@
 
 def testAccessToUnprotectedSubobjects(self):
 item = self.item
+itemb = self.a.itemb
 r_item = self.a.r_item
 item1 = self.a.item1
 item2 = self.a.item2
 item3 = self.a.item3
 self.assertPolicyAllows(item,  'public_prop')
+self.assertPolicyAllows(itemb, 'public_prop')
 self.assertPolicyDenies(r_item,'public_prop')
 self.assertPolicyAllows(item1, 'public_prop')
 self.assertPolicyAllows(item2, 'public_prop')

Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
===
--- Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 
2006-06-01 14:18:32 UTC (rev 68443)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 
2006-06-01 14:44:13 UTC (rev 68444)
@@ -99,6 +99,8 @@
 class ZopePathExpr(PathExpr):
 
 def __init__(self, name, expr, engine):
+if name == 'standard' and not expr:
+expr = 'nothing'
 super(ZopePathExpr, self).__init__(name, expr, engine,
boboAwareZopeTraverse)
 

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/AccessControl/ Make python security policy work with a boolean __aatus__

2006-06-01 Thread Florent Guillaume
Log message for revision 68446:
  Make python security policy work with a boolean __aatus__

Changed:
  U   Zope/trunk/lib/python/AccessControl/ImplPython.py
  U   Zope/trunk/lib/python/AccessControl/tests/testZopeSecurityPolicy.py

-=-
Modified: Zope/trunk/lib/python/AccessControl/ImplPython.py
===
--- Zope/trunk/lib/python/AccessControl/ImplPython.py   2006-06-01 14:46:17 UTC 
(rev 68445)
+++ Zope/trunk/lib/python/AccessControl/ImplPython.py   2006-06-01 14:48:15 UTC 
(rev 68446)
@@ -318,7 +318,7 @@
 
 if p is not None:
 tp = p.__class__
-if tp is not int:
+if tp is not int and tp is not bool:
 if tp is dict:
 if isinstance(name, basestring):
 p = p.get(name)

Modified: Zope/trunk/lib/python/AccessControl/tests/testZopeSecurityPolicy.py
===
--- Zope/trunk/lib/python/AccessControl/tests/testZopeSecurityPolicy.py 
2006-06-01 14:46:17 UTC (rev 68445)
+++ Zope/trunk/lib/python/AccessControl/tests/testZopeSecurityPolicy.py 
2006-06-01 14:48:15 UTC (rev 68446)
@@ -113,6 +113,11 @@
 __allow_access_to_unprotected_subobjects__ = 1
 
 
+class UnprotectedSimpleItemBool (SimpleItemish):
+
+__allow_access_to_unprotected_subobjects__ = True
+
+
 class OwnedSimpleItem(UnprotectedSimpleItem):
 def getOwner(self, info=0):
 if info:
@@ -159,6 +164,7 @@
 a = App()
 self.a = a
 a.item = UnprotectedSimpleItem()
+a.itemb = UnprotectedSimpleItemBool()
 self.item = a.item
 a.r_item = RestrictedSimpleItem()
 a.item1 = PartlyProtectedSimpleItem1()
@@ -237,11 +243,13 @@
 
 def testAccessToUnprotectedSubobjects(self):
 item = self.item
+itemb = self.a.itemb
 r_item = self.a.r_item
 item1 = self.a.item1
 item2 = self.a.item2
 item3 = self.a.item3
 self.assertPolicyAllows(item,  'public_prop')
+self.assertPolicyAllows(itemb, 'public_prop')
 self.assertPolicyDenies(r_item,'public_prop')
 self.assertPolicyAllows(item1, 'public_prop')
 self.assertPolicyAllows(item2, 'public_prop')

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/AccessControl/ Make python security policy work with a boolean __aatus__

2006-06-01 Thread Florent Guillaume
Log message for revision 68447:
  Make python security policy work with a boolean __aatus__

Changed:
  U   Zope/branches/2.9/lib/python/AccessControl/ImplPython.py
  U   Zope/branches/2.9/lib/python/AccessControl/tests/testZopeSecurityPolicy.py

-=-
Modified: Zope/branches/2.9/lib/python/AccessControl/ImplPython.py
===
--- Zope/branches/2.9/lib/python/AccessControl/ImplPython.py2006-06-01 
14:48:15 UTC (rev 68446)
+++ Zope/branches/2.9/lib/python/AccessControl/ImplPython.py2006-06-01 
16:08:52 UTC (rev 68447)
@@ -317,7 +317,7 @@
 
 if p is not None:
 tp = p.__class__
-if tp is not int:
+if tp is not int and tp is not bool:
 if tp is dict:
 if isinstance(name, basestring):
 p = p.get(name)

Modified: 
Zope/branches/2.9/lib/python/AccessControl/tests/testZopeSecurityPolicy.py
===
--- Zope/branches/2.9/lib/python/AccessControl/tests/testZopeSecurityPolicy.py  
2006-06-01 14:48:15 UTC (rev 68446)
+++ Zope/branches/2.9/lib/python/AccessControl/tests/testZopeSecurityPolicy.py  
2006-06-01 16:08:52 UTC (rev 68447)
@@ -113,6 +113,11 @@
 __allow_access_to_unprotected_subobjects__ = 1
 
 
+class UnprotectedSimpleItemBool (SimpleItemish):
+
+__allow_access_to_unprotected_subobjects__ = True
+
+
 class OwnedSimpleItem(UnprotectedSimpleItem):
 def getOwner(self, info=0):
 if info:
@@ -159,6 +164,7 @@
 a = App()
 self.a = a
 a.item = UnprotectedSimpleItem()
+a.itemb = UnprotectedSimpleItemBool()
 self.item = a.item
 a.r_item = RestrictedSimpleItem()
 a.item1 = PartlyProtectedSimpleItem1()
@@ -237,11 +243,13 @@
 
 def testAccessToUnprotectedSubobjects(self):
 item = self.item
+itemb = self.a.itemb
 r_item = self.a.r_item
 item1 = self.a.item1
 item2 = self.a.item2
 item3 = self.a.item3
 self.assertPolicyAllows(item,  'public_prop')
+self.assertPolicyAllows(itemb, 'public_prop')
 self.assertPolicyDenies(r_item,'public_prop')
 self.assertPolicyAllows(item1, 'public_prop')
 self.assertPolicyAllows(item2, 'public_prop')

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/AccessControl/ImplPython.py Use isinstance, like the C implementation.

2006-06-01 Thread Florent Guillaume
Log message for revision 68448:
  Use isinstance, like the C implementation.
  

Changed:
  U   Zope/branches/2.10/lib/python/AccessControl/ImplPython.py

-=-
Modified: Zope/branches/2.10/lib/python/AccessControl/ImplPython.py
===
--- Zope/branches/2.10/lib/python/AccessControl/ImplPython.py   2006-06-01 
16:08:52 UTC (rev 68447)
+++ Zope/branches/2.10/lib/python/AccessControl/ImplPython.py   2006-06-01 
16:29:40 UTC (rev 68448)
@@ -317,9 +317,8 @@
 None)
 
 if p is not None:
-tp = p.__class__
-if tp is not int and tp is not bool:
-if tp is dict:
+if not isinstance(p, int): # catches bool too
+if isinstance(p, dict):
 if isinstance(name, basestring):
 p = p.get(name)
 else:

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/AccessControl/ImplPython.py Use isinstance, like the C implementation.

2006-06-01 Thread Florent Guillaume
Log message for revision 68449:
  Use isinstance, like the C implementation.
  

Changed:
  U   Zope/trunk/lib/python/AccessControl/ImplPython.py

-=-
Modified: Zope/trunk/lib/python/AccessControl/ImplPython.py
===
--- Zope/trunk/lib/python/AccessControl/ImplPython.py   2006-06-01 16:29:40 UTC 
(rev 68448)
+++ Zope/trunk/lib/python/AccessControl/ImplPython.py   2006-06-01 16:30:15 UTC 
(rev 68449)
@@ -317,9 +317,8 @@
 None)
 
 if p is not None:
-tp = p.__class__
-if tp is not int and tp is not bool:
-if tp is dict:
+if not isinstance(p, int): # catches bool too
+if isinstance(p, dict):
 if isinstance(name, basestring):
 p = p.get(name)
 else:

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PageTemplates/PageTemplateFile.py There must be no warning when __name__ is supplied.

2006-05-31 Thread Florent Guillaume
Log message for revision 68414:
  There must be no warning when __name__ is supplied.

Changed:
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/PageTemplateFile.py

-=-
Modified: 
Zope/branches/2.10/lib/python/Products/PageTemplates/PageTemplateFile.py
===
--- Zope/branches/2.10/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-05-31 17:36:17 UTC (rev 68413)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-05-31 17:59:21 UTC (rev 68414)
@@ -59,15 +59,13 @@
 _default_bindings = {'name_subpath': 'traverse_subpath'}
 
 def __init__(self, filename, _prefix=None, **kw):
-name = None
-if kw.has_key('__name__'):
-name = kw['__name__']
-del kw['__name__'] 
+name = kw.pop('__name__', None)
 
 basepath, ext = os.path.splitext(filename)
 
 if name:
 self.id = self.__name__ = name
+self._need__name__ = 0
 else:
 self.id = self.__name__ = os.path.basename(basepath)
 

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py Merged r68414 from 2.10 branch:

2006-05-31 Thread Florent Guillaume
Log message for revision 68415:
  Merged r68414 from 2.10 branch:
  There must be no warning when __name__ is supplied.
  

Changed:
  U   Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py

-=-
Modified: Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-05-31 17:59:21 UTC (rev 68414)
+++ Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-05-31 18:00:30 UTC (rev 68415)
@@ -59,15 +59,13 @@
 _default_bindings = {'name_subpath': 'traverse_subpath'}
 
 def __init__(self, filename, _prefix=None, **kw):
-name = None
-if kw.has_key('__name__'):
-name = kw['__name__']
-del kw['__name__'] 
+name = kw.pop('__name__', None)
 
 basepath, ext = os.path.splitext(filename)
 
 if name:
 self.id = self.__name__ = name
+self._need__name__ = 0
 else:
 self.id = self.__name__ = os.path.basename(basepath)
 

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ZClasses/ZClass.txt Fix temp_folder mounting problem.

2006-01-16 Thread Florent Guillaume
Log message for revision 41327:
  Fix temp_folder mounting problem.
  
  Othere tests don't pass though, maybe I think due to __implemented__ and
  __provides__ attributes in the persistentclass state.
  

Changed:
  U   Zope/branches/2.9/lib/python/ZClasses/ZClass.txt

-=-
Modified: Zope/branches/2.9/lib/python/ZClasses/ZClass.txt
===
--- Zope/branches/2.9/lib/python/ZClasses/ZClass.txt2006-01-16 15:10:30 UTC 
(rev 41326)
+++ Zope/branches/2.9/lib/python/ZClasses/ZClass.txt2006-01-16 16:38:25 UTC 
(rev 41327)
@@ -16,6 +16,8 @@
  from OFS.Application import Application
  app = Application()
  conn.root()['Application'] = app
+ from OFS.Folder import manage_addFolder
+ manage_addFolder(app, 'temp_folder')
  from OFS.Application import initialize
  initialize(app)
  app.manage_addFolder('sandbox')

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Zope2/App/startup.py When a database is created by hand from a custom_zodb.py during

2006-01-13 Thread Florent Guillaume
Log message for revision 41303:
  When a database is created by hand from a custom_zodb.py during
  startup, we still want to put it in the dbtab multidatabases dict.
  
  This happens when unit tests call Zope2.startup(), because Testing has a
  specific custom_zodb.py loaded at startup that uses a DemoStorage.
  

Changed:
  U   Zope/branches/2.9/lib/python/Zope2/App/startup.py

-=-
Modified: Zope/branches/2.9/lib/python/Zope2/App/startup.py
===
--- Zope/branches/2.9/lib/python/Zope2/App/startup.py   2006-01-13 16:26:04 UTC 
(rev 41302)
+++ Zope/branches/2.9/lib/python/Zope2/App/startup.py   2006-01-13 16:47:56 UTC 
(rev 41303)
@@ -45,28 +45,31 @@
 # Import products
 OFS.Application.import_products()
 
+configuration = getConfiguration()
+
 # Open the database
+dbtab = configuration.dbtab
 try:
 # Try to use custom storage
 try:
-m=imp.find_module('custom_zodb',[getConfiguration().testinghome])
+m=imp.find_module('custom_zodb',[configuration.testinghome])
 except:
-m=imp.find_module('custom_zodb',[getConfiguration().instancehome])
+m=imp.find_module('custom_zodb',[configuration.instancehome])
 except:
 # if there is no custom_zodb, use the config file specified databases
-configuration = getConfiguration()
-DB = configuration.dbtab.getDatabase('/', is_root=1)
-Globals.BobobaseName = DB.getName()
+DB = dbtab.getDatabase('/', is_root=1)
 else:
 m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2])
+sys.modules['Zope2.custom_zodb']=m
+
 if hasattr(m,'DB'):
 DB=m.DB
+dbtab.databases.update(getattr(DB, 'databases', {}))
+DB.databases = dbtab.databases
 else:
-storage = m.Storage
-DB = ZODB.DB(storage)
+DB = ZODB.DB(m.Storage, databases=dbtab.databases)
 
-Globals.BobobaseName = DB.getName()
-sys.modules['Zope2.custom_zodb']=m
+Globals.BobobaseName = DB.getName()
 
 if DB.getActivityMonitor() is None:
 from ZODB.ActivityMonitor import ActivityMonitor

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/CopySupport.py Forgotten import.

2005-12-20 Thread Florent Guillaume
Log message for revision 40929:
  Forgotten import.
  

Changed:
  U   Zope/trunk/lib/python/OFS/CopySupport.py

-=-
Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===
--- Zope/trunk/lib/python/OFS/CopySupport.py2005-12-21 00:04:08 UTC (rev 
40928)
+++ Zope/trunk/lib/python/OFS/CopySupport.py2005-12-21 00:05:31 UTC (rev 
40929)
@@ -34,6 +34,7 @@
 from App.Dialogs import MessageDialog
 from webdav.Lockable import ResourceLockedError
 from zExceptions import Unauthorized, BadRequest
+from ZODB.POSException import ConflictError
 from zope.interface import implements
 from zope.event import notify
 from zope.app.event.objectevent import ObjectCopiedEvent

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


[Zope-Checkins] SVN: Zope/branches/2.9/ Added a 'conflict-error-log-level' directive to zope.conf, to set the

2005-12-18 Thread Florent Guillaume
Log message for revision 40864:
  Added a 'conflict-error-log-level' directive to zope.conf, to set the
  level at which conflict errors (which are normally retried
  automatically) are logged. The default is 'info'.
  
  This doesn't interfere with the error_log site object which copies
  non-retried conflict errors the the error log at level 'error'.
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Zope2/App/startup.py
  U   Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml
  U   Zope/branches/2.9/skel/etc/zope.conf.in

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2005-12-18 14:23:26 UTC (rev 40863)
+++ Zope/branches/2.9/doc/CHANGES.txt   2005-12-18 19:01:42 UTC (rev 40864)
@@ -44,6 +44,10 @@
 
  - The SiteErrorLog now copies exceptions to the event log by default.
 
+ - Added a 'conflict-error-log-level' directive to zope.conf, to set
+   the level at which conflict errors (which are normally retried
+   automatically) are logged. The default is 'info'.
+
   Zope 2.9.0 beta 1 (2005/12/06)
 
 Features added

Modified: Zope/branches/2.9/lib/python/Zope2/App/startup.py
===
--- Zope/branches/2.9/lib/python/Zope2/App/startup.py   2005-12-18 14:23:26 UTC 
(rev 40863)
+++ Zope/branches/2.9/lib/python/Zope2/App/startup.py   2005-12-18 19:01:42 UTC 
(rev 40864)
@@ -136,7 +136,7 @@
 conflict_errors = 0
 unresolved_conflict_errors = 0
 
-conflict_logger = logging.getLogger('ZODB.Conflict')
+conflict_logger = logging.getLogger('ZPublisher.Conflict')
 
 def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
 global unresolved_conflict_errors
@@ -149,19 +149,18 @@
 if t is SystemExit:
 raise
 if issubclass(t, ConflictError):
-conflict_errors = conflict_errors + 1
-# This logs _all_ conflict errors
-conflict_logger.info(
-'%s at %s (%i conflicts, of which %i'
-' were unresolved, since startup at %s)',
-v,
-REQUEST.get('PATH_INFO', 'unknown'),
-conflict_errors,
-unresolved_conflict_errors,
-startup_time
-)
-# This debug logging really doesn't help a lot...
-conflict_logger.debug('Conflict traceback',exc_info=True)
+conflict_errors += 1
+level = getConfiguration().conflict_error_log_level
+if level:
+conflict_logger.log(level,
+%s at %s: %s (%d conflicts (%d unresolved) 
+since startup at %s),
+v.__class__.__name__,
+REQUEST.get('PATH_INFO', 'unknown'),
+v,
+conflict_errors,
+unresolved_conflict_errors,
+startup_time)
 raise ZPublisher.Retry(t, v, traceback)
 if t is ZPublisher.Retry:
 try:

Modified: Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml
===
--- Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml   2005-12-18 
14:23:26 UTC (rev 40863)
+++ Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml   2005-12-18 
19:01:42 UTC (rev 40864)
@@ -760,6 +760,20 @@
 /description
   /section
 
+  key name=conflict-error-log-level
+   datatype=ZConfig.components.logger.datatypes.logging_level
+   default=info
+ description
+   Specifies at which level conflict errors are logged. Conflict
+   errors, when occuring in small numbers, are a normal part of the
+   Zope optimistic transaction conflict resolution algorithms. They
+   are retried automatically a few times, and are therefore usually
+   not visible by the user. You can specify 'notset' if you don't
+   want them logged, or use any other logger level.
+ /description
+ metadefaultinfo/metadefault
+  /key
+
   !-- max-listen-sockets and large-file-threshold should really go
into the ZServer package, but I can't quite figure out how to
put it there --

Modified: Zope/branches/2.9/skel/etc/zope.conf.in
===
--- Zope/branches/2.9/skel/etc/zope.conf.in 2005-12-18 14:23:26 UTC (rev 
40863)
+++ Zope/branches/2.9/skel/etc/zope.conf.in 2005-12-18 19:01:42 UTC (rev 
40864)
@@ -759,6 +759,24 @@
 #   /logfile
 # /logger
 
+
+# Directive: conflict-error-log-level
+#
+# Description:
+# Specifies at which level conflict errors are logged. Conflict
+# errors, when occuring in small numbers, are a normal part of the
+# Zope 

[Zope-Checkins] SVN: Zope/trunk/ Merged r40864 from 2.9 branch:

2005-12-18 Thread Florent Guillaume
Log message for revision 40865:
  Merged r40864 from 2.9 branch:
  Added a 'conflict-error-log-level' directive to zope.conf, to set the
  level at which conflict errors (which are normally retried
  automatically) are logged. The default is 'info'.
  
  This doesn't interfere with the error_log site object which copies
  non-retried conflict errors the the error log at level 'error'.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Zope2/App/startup.py
  U   Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml
  U   Zope/trunk/skel/etc/zope.conf.in

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-12-18 19:01:42 UTC (rev 40864)
+++ Zope/trunk/doc/CHANGES.txt  2005-12-18 19:19:29 UTC (rev 40865)
@@ -26,6 +26,10 @@
 
 Features added
 
+  - Added a 'conflict-error-log-level' directive to zope.conf, to set
+the level at which conflict errors (which are normally retried
+automatically) are logged. The default is 'info'.
+
   - The SiteErrorLog now copies exceptions to the event log by default.
 
   - deprecated OFS.content_types (to be removed in Zope 2.11) and

Modified: Zope/trunk/lib/python/Zope2/App/startup.py
===
--- Zope/trunk/lib/python/Zope2/App/startup.py  2005-12-18 19:01:42 UTC (rev 
40864)
+++ Zope/trunk/lib/python/Zope2/App/startup.py  2005-12-18 19:19:29 UTC (rev 
40865)
@@ -135,7 +135,7 @@
 conflict_errors = 0
 unresolved_conflict_errors = 0
 
-conflict_logger = logging.getLogger('ZODB.Conflict')
+conflict_logger = logging.getLogger('ZPublisher.Conflict')
 
 def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
 global unresolved_conflict_errors
@@ -148,19 +148,18 @@
 if t is SystemExit:
 raise
 if issubclass(t, ConflictError):
-conflict_errors = conflict_errors + 1
-# This logs _all_ conflict errors
-conflict_logger.info(
-'%s at %s (%i conflicts, of which %i'
-' were unresolved, since startup at %s)',
-v,
-REQUEST.get('PATH_INFO', 'unknown'),
-conflict_errors,
-unresolved_conflict_errors,
-startup_time
-)
-# This debug logging really doesn't help a lot...
-conflict_logger.debug('Conflict traceback',exc_info=True)
+conflict_errors += 1
+level = getConfiguration().conflict_error_log_level
+if level:
+conflict_logger.log(level,
+%s at %s: %s (%d conflicts (%d unresolved) 
+since startup at %s),
+v.__class__.__name__,
+REQUEST.get('PATH_INFO', 'unknown'),
+v,
+conflict_errors,
+unresolved_conflict_errors,
+startup_time)
 raise ZPublisher.Retry(t, v, traceback)
 if t is ZPublisher.Retry:
 try:

Modified: Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml
===
--- Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml  2005-12-18 19:01:42 UTC 
(rev 40864)
+++ Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml  2005-12-18 19:19:29 UTC 
(rev 40865)
@@ -760,6 +760,20 @@
 /description
   /section
 
+  key name=conflict-error-log-level
+   datatype=ZConfig.components.logger.datatypes.logging_level
+   default=info
+ description
+   Specifies at which level conflict errors are logged. Conflict
+   errors, when occuring in small numbers, are a normal part of the
+   Zope optimistic transaction conflict resolution algorithms. They
+   are retried automatically a few times, and are therefore usually
+   not visible by the user. You can specify 'notset' if you don't
+   want them logged, or use any other logger level.
+ /description
+ metadefaultinfo/metadefault
+  /key
+
   !-- max-listen-sockets and large-file-threshold should really go
into the ZServer package, but I can't quite figure out how to
put it there --

Modified: Zope/trunk/skel/etc/zope.conf.in
===
--- Zope/trunk/skel/etc/zope.conf.in2005-12-18 19:01:42 UTC (rev 40864)
+++ Zope/trunk/skel/etc/zope.conf.in2005-12-18 19:19:29 UTC (rev 40865)
@@ -759,6 +759,24 @@
 #   /logfile
 # /logger
 
+
+# Directive: conflict-error-log-level
+#
+# Description:
+# Specifies at which level conflict errors are logged. Conflict
+# errors, when occuring in small numbers, are a normal part of the
+# Zope optimistic transaction conflict resolution algorithms. 

[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ The SiteErrorLog now copies exceptions to the event log by default

2005-12-13 Thread Florent Guillaume
Log message for revision 40764:
  The SiteErrorLog now copies exceptions to the event log by default

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   
Zope/branches/Zope-2_8-branch/lib/python/Products/SiteErrorLog/SiteErrorLog.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-12-13 16:01:06 UTC 
(rev 40763)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-12-13 16:31:53 UTC 
(rev 40764)
@@ -66,6 +66,8 @@
 
 Other
 
+  - The SiteErrorLog now copies exceptions to the event log by default.
+
   - ObjectManager now has an hasObject method to test presence. This
 brings it in line with BTreeFolder.
 

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Products/SiteErrorLog/SiteErrorLog.py
===
--- 
Zope/branches/Zope-2_8-branch/lib/python/Products/SiteErrorLog/SiteErrorLog.py  
2005-12-13 16:01:06 UTC (rev 40763)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/Products/SiteErrorLog/SiteErrorLog.py  
2005-12-13 16:31:53 UTC (rev 40764)
@@ -71,7 +71,7 @@
 id = 'error_log'
 
 keep_entries = 20
-copy_to_zlog = 0
+copy_to_zlog = True
 
 security = ClassSecurityInfo()
 

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


[Zope-Checkins] SVN: Zope/branches/2.9/ The SiteErrorLog now copies exceptions to the event log by default

2005-12-13 Thread Florent Guillaume
Log message for revision 40765:
  The SiteErrorLog now copies exceptions to the event log by default

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Products/SiteErrorLog/SiteErrorLog.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2005-12-13 16:31:53 UTC (rev 40764)
+++ Zope/branches/2.9/doc/CHANGES.txt   2005-12-13 16:34:01 UTC (rev 40765)
@@ -39,7 +39,7 @@
 
 Features added
 
- - none, feature freeze :-)
+ - The SiteErrorLog now copies exceptions to the event log by default.
 
   Zope 2.9.0 beta 1 (2005/12/06)
 

Modified: Zope/branches/2.9/lib/python/Products/SiteErrorLog/SiteErrorLog.py
===
--- Zope/branches/2.9/lib/python/Products/SiteErrorLog/SiteErrorLog.py  
2005-12-13 16:31:53 UTC (rev 40764)
+++ Zope/branches/2.9/lib/python/Products/SiteErrorLog/SiteErrorLog.py  
2005-12-13 16:34:01 UTC (rev 40765)
@@ -71,7 +71,7 @@
 id = 'error_log'
 
 keep_entries = 20
-copy_to_zlog = 0
+copy_to_zlog = True
 
 security = ClassSecurityInfo()
 

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


[Zope-Checkins] SVN: Zope/branches/2.9/ ObjectManager now has an hasObject method to test presence. This

2005-12-05 Thread Florent Guillaume
Log message for revision 40536:
  ObjectManager now has an hasObject method to test presence. This
  brings it in line with BTreeFolder.
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/OFS/ObjectManager.py
  U   Zope/branches/2.9/lib/python/OFS/interfaces.py
  U   Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2005-12-05 13:54:19 UTC (rev 40535)
+++ Zope/branches/2.9/doc/CHANGES.txt   2005-12-05 15:07:46 UTC (rev 40536)
@@ -26,6 +26,9 @@
 
 Features added
 
+  - ObjectManager now has an hasObject method to test presence. This
+brings it in line with BTreeFolder.
+
   - Using FastCGI is officially deprecated
 
   - Improved logging of ConflictErrors. All conflict errors are

Modified: Zope/branches/2.9/lib/python/OFS/ObjectManager.py
===
--- Zope/branches/2.9/lib/python/OFS/ObjectManager.py   2005-12-05 13:54:19 UTC 
(rev 40535)
+++ Zope/branches/2.9/lib/python/OFS/ObjectManager.py   2005-12-05 15:07:46 UTC 
(rev 40536)
@@ -273,6 +273,20 @@
 raise AttributeError, id
 return default
 
+def hasObject(self, id):
+Indicate whether the folder has an item by ID.
+
+This doesn't try to be more intelligent than _getOb, and doesn't
+consult _objects (for performance reasons). The common use case
+is to check that an object does *not* exist.
+
+if (id in ('.', '..') or
+id.startswith('_') or
+id.startswith('aq_') or
+id.endswith('__')):
+return False
+return getattr(aq_base(self), id, None) is not None
+
 def _setObject(self, id, object, roles=None, user=None, set_owner=1,
suppress_events=False):
 Set an object into this container.

Modified: Zope/branches/2.9/lib/python/OFS/interfaces.py
===
--- Zope/branches/2.9/lib/python/OFS/interfaces.py  2005-12-05 13:54:19 UTC 
(rev 40535)
+++ Zope/branches/2.9/lib/python/OFS/interfaces.py  2005-12-05 15:07:46 UTC 
(rev 40536)
@@ -531,6 +531,10 @@
 
 
 
+def hasObject(id):
+Indicate whether the folder has an item by ID.
+
+
 def objectIds(spec=None):
 List the IDs of the subobjects of the current object.
 

Modified: Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py 2005-12-05 
13:54:19 UTC (rev 40535)
+++ Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py 2005-12-05 
15:07:46 UTC (rev 40536)
@@ -328,6 +328,22 @@
 om2._setObject(ob.getId(), ob)
 self.assertRaises(DeleteFailed, om1._delObject, 'om2')
 
+def test_hasObject(self):
+om = self._makeOne()
+self.failIf(om.hasObject('_properties'))
+self.failIf(om.hasObject('_getOb'))
+self.failIf(om.hasObject('__of__'))
+self.failIf(om.hasObject('.'))
+self.failIf(om.hasObject('..'))
+self.failIf(om.hasObject('aq_base'))
+om.zap__ = True
+self.failIf(om.hasObject('zap__'))
+self.failIf(om.hasObject('foo'))
+si = SimpleItem('foo')
+om._setObject('foo', si)
+self.assert_(om.hasObject('foo'))
+om._delObject('foo')
+self.failIf(om.hasObject('foo'))
 
 def test_setObject_checkId_ok(self):
 om = self._makeOne()

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


[Zope-Checkins] SVN: Zope/trunk/ Merged r40536 from 2.9 branch:

2005-12-05 Thread Florent Guillaume
Log message for revision 40537:
  Merged r40536 from 2.9 branch:
  ObjectManager now has an hasObject method to test presence. This
  brings it in line with BTreeFolder.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/OFS/ObjectManager.py
  U   Zope/trunk/lib/python/OFS/interfaces.py
  U   Zope/trunk/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-12-05 15:07:46 UTC (rev 40536)
+++ Zope/trunk/doc/CHANGES.txt  2005-12-05 15:12:52 UTC (rev 40537)
@@ -26,6 +26,9 @@
 
 Features added
 
+  - ObjectManager now has an hasObject method to test presence. This
+brings it in line with BTreeFolder.
+
   - Using FastCGI is offically deprecated.
 
   - Improved logging of ConflictErrors. All conflict errors are

Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===
--- Zope/trunk/lib/python/OFS/ObjectManager.py  2005-12-05 15:07:46 UTC (rev 
40536)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py  2005-12-05 15:12:52 UTC (rev 
40537)
@@ -272,6 +272,20 @@
 raise AttributeError, id
 return default
 
+def hasObject(self, id):
+Indicate whether the folder has an item by ID.
+
+This doesn't try to be more intelligent than _getOb, and doesn't
+consult _objects (for performance reasons). The common use case
+is to check that an object does *not* exist.
+
+if (id in ('.', '..') or
+id.startswith('_') or
+id.startswith('aq_') or
+id.endswith('__')):
+return False
+return getattr(aq_base(self), id, None) is not None
+
 def _setObject(self, id, object, roles=None, user=None, set_owner=1,
suppress_events=False):
 Set an object into this container.

Modified: Zope/trunk/lib/python/OFS/interfaces.py
===
--- Zope/trunk/lib/python/OFS/interfaces.py 2005-12-05 15:07:46 UTC (rev 
40536)
+++ Zope/trunk/lib/python/OFS/interfaces.py 2005-12-05 15:12:52 UTC (rev 
40537)
@@ -531,6 +531,10 @@
 
 
 
+def hasObject(id):
+Indicate whether the folder has an item by ID.
+
+
 def objectIds(spec=None):
 List the IDs of the subobjects of the current object.
 

Modified: Zope/trunk/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/trunk/lib/python/OFS/tests/testObjectManager.py2005-12-05 
15:07:46 UTC (rev 40536)
+++ Zope/trunk/lib/python/OFS/tests/testObjectManager.py2005-12-05 
15:12:52 UTC (rev 40537)
@@ -328,6 +328,22 @@
 om2._setObject(ob.getId(), ob)
 self.assertRaises(DeleteFailed, om1._delObject, 'om2')
 
+def test_hasObject(self):
+om = self._makeOne()
+self.failIf(om.hasObject('_properties'))
+self.failIf(om.hasObject('_getOb'))
+self.failIf(om.hasObject('__of__'))
+self.failIf(om.hasObject('.'))
+self.failIf(om.hasObject('..'))
+self.failIf(om.hasObject('aq_base'))
+om.zap__ = True
+self.failIf(om.hasObject('zap__'))
+self.failIf(om.hasObject('foo'))
+si = SimpleItem('foo')
+om._setObject('foo', si)
+self.assert_(om.hasObject('foo'))
+om._delObject('foo')
+self.failIf(om.hasObject('foo'))
 
 def test_setObject_checkId_ok(self):
 om = self._makeOne()

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Merged r40536 from 2.9 branch:

2005-12-05 Thread Florent Guillaume
Log message for revision 40542:
  Merged r40536 from 2.9 branch:
  ObjectManager now has an hasObject method to test presence. This
  brings it in line with BTreeFolder.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-12-05 15:15:05 UTC 
(rev 40541)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-12-05 15:23:20 UTC 
(rev 40542)
@@ -58,6 +58,9 @@
 
 Other
 
+  - ObjectManager now has an hasObject method to test presence. This
+brings it in line with BTreeFolder.
+
   - Made 'zopectl test' work for software homes which do not have
 an inplace build (it used to require that test.py be in
 $ZOPE_HOME/bin/;  now it will use $ZOPE_HOME as a fallback).

Modified: Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py   
2005-12-05 15:15:05 UTC (rev 40541)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py   
2005-12-05 15:23:20 UTC (rev 40542)
@@ -261,6 +261,20 @@
 raise AttributeError, id
 return default
 
+def hasObject(self, id):
+Indicate whether the folder has an item by ID.
+
+This doesn't try to be more intelligent than _getOb, and doesn't
+consult _objects (for performance reasons). The common use case
+is to check that an object does *not* exist.
+
+if (id in ('.', '..') or
+id.startswith('_') or
+id.startswith('aq_') or
+id.endswith('__')):
+return False
+return getattr(aq_base(self), id, None) is not None
+
 def _setObject(self, id, object, roles=None, user=None, set_owner=1):
 v=self._checkId(id)
 if v is not None: id=v

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py 
2005-12-05 15:15:05 UTC (rev 40541)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py 
2005-12-05 15:23:20 UTC (rev 40542)
@@ -303,6 +303,23 @@
 om2._setObject(ob.getId(), ob)
 self.assertRaises(DeleteFailed, om1._delObject, 'om2')
 
+def test_hasObject(self):
+om = self._makeOne()
+self.failIf(om.hasObject('_properties'))
+self.failIf(om.hasObject('_getOb'))
+self.failIf(om.hasObject('__of__'))
+self.failIf(om.hasObject('.'))
+self.failIf(om.hasObject('..'))
+self.failIf(om.hasObject('aq_base'))
+om.zap__ = True
+self.failIf(om.hasObject('zap__'))
+self.failIf(om.hasObject('foo'))
+si = SimpleItem('foo')
+om._setObject('foo', si)
+self.assert_(om.hasObject('foo'))
+om._delObject('foo')
+self.failIf(om.hasObject('foo'))
+
 def test_setObject_checkId_ok(self):
 om = self._makeOne()
 si = SimpleItem('1')

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


[Zope-Checkins] SVN: Zope/branches/2.9/ Improved logging of ConflictErrors. Now a log is made at level BLATHER

2005-12-01 Thread Florent Guillaume
Log message for revision 40454:
  Improved logging of ConflictErrors. Now a log is made at level BLATHER
  with traceback for any conflict retried. In addition, a log is made at
  level ERROR for a conflict that can't be retried anymore and is returned
  to the browser as an error. Nothing is logged anymore at level INFO.
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Zope2/App/startup.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2005-12-01 18:29:26 UTC (rev 40453)
+++ Zope/branches/2.9/doc/CHANGES.txt   2005-12-01 18:39:12 UTC (rev 40454)
@@ -24,8 +24,14 @@
 
   Trunk only (unreleased)
 
-Features added  
+Features added
 
+  - Improved logging of ConflictErrors. Now a log is made at level
+BLATHER with traceback for any conflict retried. In addition, a
+log is made at level ERROR for a conflict that can't be retried
+anymore and is returned to the browser as an error. Nothing is
+logged anymore at level INFO.
+
   - Fixed unclear security declarations. Warn when an attempt is
 made to have a security declaration on a nonexistent method.
 

Modified: Zope/branches/2.9/lib/python/Zope2/App/startup.py
===
--- Zope/branches/2.9/lib/python/Zope2/App/startup.py   2005-12-01 18:29:26 UTC 
(rev 40453)
+++ Zope/branches/2.9/lib/python/Zope2/App/startup.py   2005-12-01 18:39:12 UTC 
(rev 40454)
@@ -20,7 +20,7 @@
 from App.config import getConfiguration
 from types import StringType, ListType
 from zExceptions import Unauthorized
-from zLOG import LOG, WARNING, INFO, BLATHER, log_time
+from zLOG import LOG, ERROR, WARNING, INFO, BLATHER, log_time
 from ZODB.POSException import ConflictError
 import transaction
 import AccessControl.User
@@ -142,20 +142,25 @@
 if t is SystemExit:
 raise
 if issubclass(t, ConflictError):
-# First, we need to close the current connection. We'll
-# do this by releasing the hold on it. There should be
-# some sane protocol for this, but for now we'll use
-# brute force:
 global conflict_errors
 conflict_errors = conflict_errors + 1
 method_name = REQUEST.get('PATH_INFO', '')
-err = ('ZODB conflict error at %s '
-   '(%s conflicts since startup at %s)')
-LOG(err % (method_name, conflict_errors, startup_time),
-INFO, '')
-LOG('Conflict traceback', BLATHER, '', error=sys.exc_info())
+LOG('ZODB', BLATHER, %s at %s: %s
+ (%s conflicts since startup at %s)
+% (v.__class__.__name__, method_name, v,
+   conflict_errors, startup_time),
+error=(t, v, traceback))
 raise ZPublisher.Retry(t, v, traceback)
-if t is ZPublisher.Retry: v.reraise()
+if t is ZPublisher.Retry:
+# An exception that can't be retried anymore
+# Retrieve the original exception
+try: v.reraise()
+except: t, v, traceback = sys.exc_info()
+# Log it as ERROR
+method_name = REQUEST.get('PATH_INFO', '')
+LOG('Publisher', ERROR, Unhandled %s at %s: %s
+% (v.__class__.__name__, method_name, v))
+# Then fall through to display the error to the user
 
 try:
 log = aq_acquire(published, '__error_log__', containment=1)

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


[Zope-Checkins] SVN: Zope/trunk/ Merged r40454 from 2.9 branch:

2005-12-01 Thread Florent Guillaume
Log message for revision 40455:
  Merged r40454 from 2.9 branch:
  Improved logging of ConflictErrors. Now a log is made at level BLATHER
  with traceback for any conflict retried. In addition, a log is made at
  level ERROR for a conflict that can't be retried anymore and is returned
  to the browser as an error. Nothing is logged anymore at level INFO.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Zope2/App/startup.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-12-01 18:39:12 UTC (rev 40454)
+++ Zope/trunk/doc/CHANGES.txt  2005-12-01 18:46:44 UTC (rev 40455)
@@ -26,6 +26,12 @@
 
 Features added
 
+  - Improved logging of ConflictErrors. Now a log is made at level
+BLATHER with traceback for any conflict retried. In addition, a
+log is made at level ERROR for a conflict that can't be retried
+anymore and is returned to the browser as an error. Nothing is
+logged anymore at level INFO.
+
   - Use new-style security declarations everywhere possible. This
 means remove the use of __ac_permissions__, foo__roles__ and
 default__class_init__. A few corner cases can't be converted

Modified: Zope/trunk/lib/python/Zope2/App/startup.py
===
--- Zope/trunk/lib/python/Zope2/App/startup.py  2005-12-01 18:39:12 UTC (rev 
40454)
+++ Zope/trunk/lib/python/Zope2/App/startup.py  2005-12-01 18:46:44 UTC (rev 
40455)
@@ -20,7 +20,7 @@
 from App.config import getConfiguration
 from types import StringType, ListType
 from zExceptions import Unauthorized
-from zLOG import LOG, WARNING, INFO, BLATHER, log_time
+from zLOG import LOG, ERROR, WARNING, INFO, BLATHER, log_time
 from ZODB.POSException import ConflictError
 import transaction
 import AccessControl.User
@@ -142,20 +142,25 @@
 if t is SystemExit:
 raise
 if issubclass(t, ConflictError):
-# First, we need to close the current connection. We'll
-# do this by releasing the hold on it. There should be
-# some sane protocol for this, but for now we'll use
-# brute force:
 global conflict_errors
 conflict_errors = conflict_errors + 1
 method_name = REQUEST.get('PATH_INFO', '')
-err = ('ZODB conflict error at %s '
-   '(%s conflicts since startup at %s)')
-LOG(err % (method_name, conflict_errors, startup_time),
-INFO, '')
-LOG('Conflict traceback', BLATHER, '', error=sys.exc_info())
+LOG('ZODB', BLATHER, %s at %s: %s
+ (%s conflicts since startup at %s)
+% (v.__class__.__name__, method_name, v,
+   conflict_errors, startup_time),
+error=(t, v, traceback))
 raise ZPublisher.Retry(t, v, traceback)
-if t is ZPublisher.Retry: v.reraise()
+if t is ZPublisher.Retry:
+# An exception that can't be retried anymore
+# Retrieve the original exception
+try: v.reraise()
+except: t, v, traceback = sys.exc_info()
+# Log it as ERROR
+method_name = REQUEST.get('PATH_INFO', '')
+LOG('Publisher', ERROR, Unhandled %s at %s: %s
+% (v.__class__.__name__, method_name, v))
+# Then fall through to display the error to the user
 
 try:
 log = aq_acquire(published, '__error_log__', containment=1)

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Products/SiteAccess/SiteRoot.py Fixed #1960. Simplified dumb useless dialog.

2005-11-30 Thread Florent Guillaume
Log message for revision 40432:
  Fixed #1960. Simplified dumb useless dialog.

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Products/SiteAccess/SiteRoot.py

-=-
Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Products/SiteAccess/SiteRoot.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/Products/SiteAccess/SiteRoot.py
2005-11-30 22:43:01 UTC (rev 40431)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/SiteAccess/SiteRoot.py
2005-11-30 22:55:29 UTC (rev 40432)
@@ -98,9 +98,7 @@
 self.__init__(title, base, path)
 if REQUEST:
 return MessageDialog(title='SiteRoot changed.',
-  message='The title is now %sbr'
-  'The base is now %sbr'
-  'The path is now %sbr' % map(escape, (title, base, 
path)),
+  message='SiteRoot changed.',
   action='%s/manage_main' % REQUEST['URL1'])
 
 def __call__(self, client, request, response=None):

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Products/SiteAccess/SiteRoot.py Fixed #1960. Simplified dumb useless dialog.

2005-11-30 Thread Florent Guillaume
Log message for revision 40433:
  Fixed #1960. Simplified dumb useless dialog.

Changed:
  U   Zope/branches/2.9/lib/python/Products/SiteAccess/SiteRoot.py

-=-
Modified: Zope/branches/2.9/lib/python/Products/SiteAccess/SiteRoot.py
===
--- Zope/branches/2.9/lib/python/Products/SiteAccess/SiteRoot.py
2005-11-30 22:55:29 UTC (rev 40432)
+++ Zope/branches/2.9/lib/python/Products/SiteAccess/SiteRoot.py
2005-11-30 22:57:33 UTC (rev 40433)
@@ -98,9 +98,7 @@
 self.__init__(title, base, path)
 if REQUEST:
 return MessageDialog(title='SiteRoot changed.',
-  message='The title is now %sbr'
-  'The base is now %sbr'
-  'The path is now %sbr' % map(escape, (title, base, 
path)),
+  message='SiteRoot changed.',
   action='%s/manage_main' % REQUEST['URL1'])
 
 def __call__(self, client, request, response=None):

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/AccessControl/ Fixed problem with security.setPermissionDefault when the permission

2005-11-29 Thread Florent Guillaume
Log message for revision 40403:
  Fixed problem with security.setPermissionDefault when the permission
  wasn't used anywhere else in the class to protect methods.
  

Changed:
  U   Zope/branches/2.9/lib/python/AccessControl/SecurityInfo.py
  U   Zope/branches/2.9/lib/python/AccessControl/tests/testClassSecurityInfo.py

-=-
Modified: Zope/branches/2.9/lib/python/AccessControl/SecurityInfo.py
===
--- Zope/branches/2.9/lib/python/AccessControl/SecurityInfo.py  2005-11-29 
14:30:14 UTC (rev 40402)
+++ Zope/branches/2.9/lib/python/AccessControl/SecurityInfo.py  2005-11-29 
14:54:15 UTC (rev 40403)
@@ -180,6 +180,10 @@
 else:
 entry = (permission_name, tuple(names))
 __ac_permissions__.append(entry)
+for permission_name, roles in self.roles.items():
+if permission_name not in ac_permissions:
+entry = (permission_name, (), tuple(roles.keys()))
+__ac_permissions__.append(entry)
 setattr(classobj, '__ac_permissions__', tuple(__ac_permissions__))
 
 # Take care of default attribute access policy

Modified: 
Zope/branches/2.9/lib/python/AccessControl/tests/testClassSecurityInfo.py
===
--- Zope/branches/2.9/lib/python/AccessControl/tests/testClassSecurityInfo.py   
2005-11-29 14:30:14 UTC (rev 40402)
+++ Zope/branches/2.9/lib/python/AccessControl/tests/testClassSecurityInfo.py   
2005-11-29 14:54:15 UTC (rev 40403)
@@ -44,6 +44,8 @@
 
 security = ClassSecurityInfo()
 
+security.setPermissionDefault('Make food', ('Chef',))
+
 security.setPermissionDefault(
 'Test permission',
 ('Manager', 'Role A', 'Role B', 'Role C')
@@ -68,7 +70,12 @@
 for item in ('Manager', 'Role A', 'Role B', 'Role C'):
 self.failUnless(item in imPermissionRole)
 
+# Make sure that a permission defined without accompanying method
+# is still reflected in __ac_permissions__
+self.assertEquals([t for t in Test.__ac_permissions__ if not t[1]],
+  [('Make food', (), ('Chef',))])
 
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(ClassSecurityInfoTests))

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/AccessControl/ Merged r40403 from 2.9 branch:

2005-11-29 Thread Florent Guillaume
Log message for revision 40404:
  Merged r40403 from 2.9 branch:
  Fixed problem with security.setPermissionDefault when the permission
  wasn't used anywhere else in the class to protect methods.
  

Changed:
  U   Zope/trunk/lib/python/AccessControl/SecurityInfo.py
  U   Zope/trunk/lib/python/AccessControl/tests/testClassSecurityInfo.py

-=-
Modified: Zope/trunk/lib/python/AccessControl/SecurityInfo.py
===
--- Zope/trunk/lib/python/AccessControl/SecurityInfo.py 2005-11-29 14:54:15 UTC 
(rev 40403)
+++ Zope/trunk/lib/python/AccessControl/SecurityInfo.py 2005-11-29 14:56:48 UTC 
(rev 40404)
@@ -180,6 +180,10 @@
 else:
 entry = (permission_name, tuple(names))
 __ac_permissions__.append(entry)
+for permission_name, roles in self.roles.items():
+if permission_name not in ac_permissions:
+entry = (permission_name, (), tuple(roles.keys()))
+__ac_permissions__.append(entry)
 setattr(classobj, '__ac_permissions__', tuple(__ac_permissions__))
 
 # Take care of default attribute access policy

Modified: Zope/trunk/lib/python/AccessControl/tests/testClassSecurityInfo.py
===
--- Zope/trunk/lib/python/AccessControl/tests/testClassSecurityInfo.py  
2005-11-29 14:54:15 UTC (rev 40403)
+++ Zope/trunk/lib/python/AccessControl/tests/testClassSecurityInfo.py  
2005-11-29 14:56:48 UTC (rev 40404)
@@ -44,6 +44,8 @@
 
 security = ClassSecurityInfo()
 
+security.setPermissionDefault('Make food', ('Chef',))
+
 security.setPermissionDefault(
 'Test permission',
 ('Manager', 'Role A', 'Role B', 'Role C')
@@ -68,7 +70,12 @@
 for item in ('Manager', 'Role A', 'Role B', 'Role C'):
 self.failUnless(item in imPermissionRole)
 
+# Make sure that a permission defined without accompanying method
+# is still reflected in __ac_permissions__
+self.assertEquals([t for t in Test.__ac_permissions__ if not t[1]],
+  [('Make food', (), ('Chef',))])
 
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(ClassSecurityInfoTests))

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


[Zope-Checkins] SVN: Zope/branches/2.9/doc/CHANGES.txt Update CHANGES.

2005-11-29 Thread Florent Guillaume
Log message for revision 40405:
  Update CHANGES.
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2005-11-29 14:56:48 UTC (rev 40404)
+++ Zope/branches/2.9/doc/CHANGES.txt   2005-11-29 15:03:04 UTC (rev 40405)
@@ -95,6 +95,10 @@
 
 Bugs Fixed
 
+  - AccessControl.SecurityInfo: Fixed problem with
+setPermissionDefault when the permission wasn't used anywhere
+else in the class to protect methods.
+
   - OFS PropertySheets / webdav: Fixed dav__resourcetype.
 __dav_collection__ with a false value was overridden by
 isAnObjectManager.

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Merged r40403 from 2.9 branch:

2005-11-29 Thread Florent Guillaume
Log message for revision 40406:
  Merged r40403 from 2.9 branch:
  Fixed problem with security.setPermissionDefault when the permission
  wasn't used anywhere else in the class to protect methods.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py
  U   
Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testClassSecurityInfo.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-11-29 15:03:04 UTC 
(rev 40405)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-11-29 15:05:15 UTC 
(rev 40406)
@@ -26,6 +26,10 @@
 
 Bugs Fixed
 
+  - AccessControl.SecurityInfo: Fixed problem with
+setPermissionDefault when the permission wasn't used anywhere
+else in the class to protect methods.
+
   - Collector #1957:  Made ZPublisher.HTTPResponse._error_html
 return conformant XHTML.
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py  
2005-11-29 15:03:04 UTC (rev 40405)
+++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py  
2005-11-29 15:05:15 UTC (rev 40406)
@@ -180,6 +180,10 @@
 else:
 entry = (permission_name, tuple(names))
 __ac_permissions__.append(entry)
+for permission_name, roles in self.roles.items():
+if permission_name not in ac_permissions:
+entry = (permission_name, (), tuple(roles.keys()))
+__ac_permissions__.append(entry)
 setattr(classobj, '__ac_permissions__', tuple(__ac_permissions__))
 
 # Take care of default attribute access policy

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testClassSecurityInfo.py
===
--- 
Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testClassSecurityInfo.py
   2005-11-29 15:03:04 UTC (rev 40405)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testClassSecurityInfo.py
   2005-11-29 15:05:15 UTC (rev 40406)
@@ -44,6 +44,8 @@
 
 security = ClassSecurityInfo()
 
+security.setPermissionDefault('Make food', ('Chef',))
+
 security.setPermissionDefault(
 'Test permission',
 ('Manager', 'Role A', 'Role B', 'Role C')
@@ -68,7 +70,12 @@
 for item in ('Manager', 'Role A', 'Role B', 'Role C'):
 self.failUnless(item in imPermissionRole)
 
+# Make sure that a permission defined without accompanying method
+# is still reflected in __ac_permissions__
+self.assertEquals([t for t in Test.__ac_permissions__ if not t[1]],
+  [('Make food', (), ('Chef',))])
 
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(ClassSecurityInfoTests))

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/OFS/ Added backward compat for suppress_events parameter passing.

2005-11-29 Thread Florent Guillaume
Log message for revision 40408:
  Added backward compat for suppress_events parameter passing.

Changed:
  U   Zope/branches/2.9/lib/python/OFS/CopySupport.py
  U   Zope/branches/2.9/lib/python/OFS/OrderSupport.py

-=-
Modified: Zope/branches/2.9/lib/python/OFS/CopySupport.py
===
--- Zope/branches/2.9/lib/python/OFS/CopySupport.py 2005-11-29 15:25:58 UTC 
(rev 40407)
+++ Zope/branches/2.9/lib/python/OFS/CopySupport.py 2005-11-29 15:42:12 UTC 
(rev 40408)
@@ -16,6 +16,7 @@
 
 
 import re, sys, tempfile
+import warnings
 from cgi import escape
 from marshal import loads, dumps
 from urllib import quote, unquote
@@ -266,11 +267,27 @@
 # along to the new location if needed.
 ob.manage_changeOwnershipType(explicit=1)
 
-orig_container._delObject(orig_id, suppress_events=True)
+try:
+orig_container._delObject(orig_id, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+orig_container._delObject(orig_id)
+warnings.warn(
+%s._delObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+orig_container.__class__.__name__, DeprecationWarning)
 ob = aq_base(ob)
 ob._setId(id)
 
-self._setObject(id, ob, set_owner=0, suppress_events=True)
+try:
+self._setObject(id, ob, set_owner=0, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self._setObject(id, ob, set_owner=0)
+warnings.warn(
+%s._setObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 ob = self._getOb(id)
 
 notify(ObjectMovedEvent(ob, orig_container, orig_id, self, id))
@@ -337,13 +354,29 @@
 
 notify(ObjectWillBeMovedEvent(ob, self, id, self, new_id))
 
-self._delObject(id, suppress_events=True)
+try:
+self._delObject(id, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self._delObject(id)
+warnings.warn(
+%s._delObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 ob = aq_base(ob)
 ob._setId(new_id)
 
 # Note - because a rename always keeps the same context, we
 # can just leave the ownership info unchanged.
-self._setObject(new_id, ob, set_owner=0, suppress_events=True)
+try:
+self._setObject(new_id, ob, set_owner=0, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self._setObject(new_id, ob, set_owner=0)
+warnings.warn(
+%s._setObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 ob = self._getOb(new_id)
 
 notify(ObjectMovedEvent(ob, self, id, self, new_id))

Modified: Zope/branches/2.9/lib/python/OFS/OrderSupport.py
===
--- Zope/branches/2.9/lib/python/OFS/OrderSupport.py2005-11-29 15:25:58 UTC 
(rev 40407)
+++ Zope/branches/2.9/lib/python/OFS/OrderSupport.py2005-11-29 15:42:12 UTC 
(rev 40408)
@@ -16,7 +16,7 @@
 
 
 from types import StringType
-
+import warnings
 from AccessControl import ClassSecurityInfo
 from AccessControl.Permissions import access_contents_information
 from AccessControl.Permissions import manage_properties
@@ -263,7 +263,16 @@
 old_position = self.getObjectPosition(id)
 result = super(OrderSupport, self).manage_renameObject(id, new_id,
REQUEST)
-self.moveObjectToPosition(new_id, old_position, suppress_events=True)
+try:
+self.moveObjectToPosition(new_id, old_position,
+  suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self.moveObjectToPosition(new_id, old_position)
+warnings.warn(
+%s.moveObjectToPosition without suppress_events is 
+deprecated and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 return result
 
 def tpValues(self):

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/ Merged r40408 from 2.9 branch:

2005-11-29 Thread Florent Guillaume
Log message for revision 40409:
  Merged r40408 from 2.9 branch:
  Added backward compat for suppress_events parameter passing.
  

Changed:
  U   Zope/trunk/lib/python/OFS/CopySupport.py
  U   Zope/trunk/lib/python/OFS/OrderSupport.py

-=-
Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===
--- Zope/trunk/lib/python/OFS/CopySupport.py2005-11-29 15:42:12 UTC (rev 
40408)
+++ Zope/trunk/lib/python/OFS/CopySupport.py2005-11-29 15:43:35 UTC (rev 
40409)
@@ -16,6 +16,7 @@
 
 
 import re, sys, tempfile
+import warnings
 from cgi import escape
 from marshal import loads, dumps
 from urllib import quote, unquote
@@ -267,11 +268,27 @@
 # along to the new location if needed.
 ob.manage_changeOwnershipType(explicit=1)
 
-orig_container._delObject(orig_id, suppress_events=True)
+try:
+orig_container._delObject(orig_id, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+orig_container._delObject(orig_id)
+warnings.warn(
+%s._delObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+orig_container.__class__.__name__, DeprecationWarning)
 ob = aq_base(ob)
 ob._setId(id)
 
-self._setObject(id, ob, set_owner=0, suppress_events=True)
+try:
+self._setObject(id, ob, set_owner=0, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self._setObject(id, ob, set_owner=0)
+warnings.warn(
+%s._setObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 ob = self._getOb(id)
 
 notify(ObjectMovedEvent(ob, orig_container, orig_id, self, id))
@@ -341,13 +358,29 @@
 
 notify(ObjectWillBeMovedEvent(ob, self, id, self, new_id))
 
-self._delObject(id, suppress_events=True)
+try:
+self._delObject(id, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self._delObject(id)
+warnings.warn(
+%s._delObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 ob = aq_base(ob)
 ob._setId(new_id)
 
 # Note - because a rename always keeps the same context, we
 # can just leave the ownership info unchanged.
-self._setObject(new_id, ob, set_owner=0, suppress_events=True)
+try:
+self._setObject(new_id, ob, set_owner=0, suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self._setObject(new_id, ob, set_owner=0)
+warnings.warn(
+%s._setObject without suppress_events is deprecated 
+and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 ob = self._getOb(new_id)
 
 notify(ObjectMovedEvent(ob, self, id, self, new_id))

Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===
--- Zope/trunk/lib/python/OFS/OrderSupport.py   2005-11-29 15:42:12 UTC (rev 
40408)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py   2005-11-29 15:43:35 UTC (rev 
40409)
@@ -16,7 +16,7 @@
 
 
 from types import StringType
-
+import warnings
 from AccessControl import ClassSecurityInfo
 from AccessControl.Permissions import access_contents_information
 from AccessControl.Permissions import manage_properties
@@ -263,7 +263,16 @@
 old_position = self.getObjectPosition(id)
 result = super(OrderSupport, self).manage_renameObject(id, new_id,
REQUEST)
-self.moveObjectToPosition(new_id, old_position, suppress_events=True)
+try:
+self.moveObjectToPosition(new_id, old_position,
+  suppress_events=True)
+except TypeError:
+# BBB: removed in Zope 2.11
+self.moveObjectToPosition(new_id, old_position)
+warnings.warn(
+%s.moveObjectToPosition without suppress_events is 
+deprecated and will be removed in Zope 2.11. %
+self.__class__.__name__, DeprecationWarning)
 return result
 
 def tpValues(self):

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/OFS/ Use ObjectCopiedEvent with an 'original' parameter.

2005-11-28 Thread Florent Guillaume
Log message for revision 40389:
  Use ObjectCopiedEvent with an 'original' parameter.

Changed:
  U   Zope/branches/2.9/lib/python/OFS/CopySupport.py
  U   Zope/branches/2.9/lib/python/OFS/ObjectManager.py
  U   Zope/branches/2.9/lib/python/OFS/OrderSupport.py

-=-
Modified: Zope/branches/2.9/lib/python/OFS/CopySupport.py
===
--- Zope/branches/2.9/lib/python/OFS/CopySupport.py 2005-11-28 14:53:55 UTC 
(rev 40388)
+++ Zope/branches/2.9/lib/python/OFS/CopySupport.py 2005-11-28 15:28:49 UTC 
(rev 40389)
@@ -33,7 +33,6 @@
 from zope.event import notify
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.container.contained import ObjectMovedEvent
-import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
 from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeMovedEvent
 from OFS.event import ObjectClonedEvent
@@ -214,9 +213,10 @@
 id = self._get_id(orig_id)
 result.append({'id': orig_id, 'new_id': id})
 
+orig_ob = ob
 ob = ob._getCopy(self)
 ob._setId(id)
-notify(ObjectCopiedEvent(ob))
+notify(ObjectCopiedEvent(ob, orig_ob))
 
 self._setObject(id, ob)
 ob = self._getOb(id)
@@ -385,9 +385,10 @@
 message=sys.exc_info()[1],
 action='manage_main')
 
+orig_ob = ob
 ob = ob._getCopy(self)
 ob._setId(id)
-notify(ObjectCopiedEvent(ob))
+notify(ObjectCopiedEvent(ob, orig_ob))
 
 self._setObject(id, ob)
 ob = self._getOb(id)

Modified: Zope/branches/2.9/lib/python/OFS/ObjectManager.py
===
--- Zope/branches/2.9/lib/python/OFS/ObjectManager.py   2005-11-28 14:53:55 UTC 
(rev 40388)
+++ Zope/branches/2.9/lib/python/OFS/ObjectManager.py   2005-11-28 15:28:49 UTC 
(rev 40389)
@@ -46,7 +46,6 @@
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
 from zope.app.container.contained import ObjectRemovedEvent
-import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
 from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeAddedEvent
 from OFS.event import ObjectWillBeRemovedEvent

Modified: Zope/branches/2.9/lib/python/OFS/OrderSupport.py
===
--- Zope/branches/2.9/lib/python/OFS/OrderSupport.py2005-11-28 14:53:55 UTC 
(rev 40388)
+++ Zope/branches/2.9/lib/python/OFS/OrderSupport.py2005-11-28 15:28:49 UTC 
(rev 40389)
@@ -24,7 +24,6 @@
 from DocumentTemplate.sequence import sort
 from Globals import InitializeClass
 from zope.interface import implements
-import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
 from zope.app.container.contained import notifyContainerModified
 
 from interfaces import IOrderedContainer as z3IOrderedContainer

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/ Merged 40389 from 2.9 branch:

2005-11-28 Thread Florent Guillaume
Log message for revision 40390:
  Merged 40389 from 2.9 branch:
  Use ObjectCopiedEvent with an 'original' parameter.
  

Changed:
  U   Zope/trunk/lib/python/OFS/CopySupport.py
  U   Zope/trunk/lib/python/OFS/ObjectManager.py
  U   Zope/trunk/lib/python/OFS/OrderSupport.py

-=-
Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===
--- Zope/trunk/lib/python/OFS/CopySupport.py2005-11-28 15:28:49 UTC (rev 
40389)
+++ Zope/trunk/lib/python/OFS/CopySupport.py2005-11-28 15:35:28 UTC (rev 
40390)
@@ -37,7 +37,6 @@
 from zope.event import notify
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.container.contained import ObjectMovedEvent
-import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
 from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeMovedEvent
 from OFS.event import ObjectClonedEvent
@@ -215,9 +214,10 @@
 id = self._get_id(orig_id)
 result.append({'id': orig_id, 'new_id': id})
 
+orig_ob = ob
 ob = ob._getCopy(self)
 ob._setId(id)
-notify(ObjectCopiedEvent(ob))
+notify(ObjectCopiedEvent(ob, orig_ob))
 
 self._setObject(id, ob)
 ob = self._getOb(id)
@@ -390,9 +390,10 @@
 message=sys.exc_info()[1],
 action='manage_main')
 
+orig_ob = ob
 ob = ob._getCopy(self)
 ob._setId(id)
-notify(ObjectCopiedEvent(ob))
+notify(ObjectCopiedEvent(ob, orig_ob))
 
 self._setObject(id, ob)
 ob = self._getOb(id)

Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===
--- Zope/trunk/lib/python/OFS/ObjectManager.py  2005-11-28 15:28:49 UTC (rev 
40389)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py  2005-11-28 15:35:28 UTC (rev 
40390)
@@ -53,7 +53,6 @@
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
 from zope.app.container.contained import ObjectRemovedEvent
-import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
 from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeAddedEvent
 from OFS.event import ObjectWillBeRemovedEvent

Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===
--- Zope/trunk/lib/python/OFS/OrderSupport.py   2005-11-28 15:28:49 UTC (rev 
40389)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py   2005-11-28 15:35:28 UTC (rev 
40390)
@@ -24,7 +24,6 @@
 from DocumentTemplate.sequence import sort
 from Globals import InitializeClass
 from zope.interface import implements
-import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
 from zope.app.container.contained import notifyContainerModified
 
 from interfaces import IOrderedContainer as z3IOrderedContainer

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/ Merged 40370 from 2.9 branch:

2005-11-25 Thread Florent Guillaume
Log message for revision 40371:
  Merged 40370 from 2.9 branch:
  
  Send ContainerModifiedEvent when appropriate.
  
  This requires Five 1.3+ = r20254.
  
  Some BBB has been kept until Zope 3.2 = r40368 is stiched in.
  
  

Changed:
  U   Zope/trunk/lib/python/OFS/CopySupport.py
  U   Zope/trunk/lib/python/OFS/ObjectManager.py
  U   Zope/trunk/lib/python/OFS/OrderSupport.py
  U   Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py

-=-
Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===
--- Zope/trunk/lib/python/OFS/CopySupport.py2005-11-25 18:47:48 UTC (rev 
40370)
+++ Zope/trunk/lib/python/OFS/CopySupport.py2005-11-25 18:50:38 UTC (rev 
40371)
@@ -37,6 +37,8 @@
 from zope.event import notify
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.container.contained import ObjectMovedEvent
+import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
+from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeMovedEvent
 from OFS.event import ObjectClonedEvent
 import OFS.subscribers
@@ -273,6 +275,9 @@
 ob = self._getOb(id)
 
 notify(ObjectMovedEvent(ob, orig_container, orig_id, self, id))
+notifyContainerModified(orig_container)
+if aq_base(orig_container) is not aq_base(self):
+notifyContainerModified(self)
 
 ob._postCopy(self, op=1)
 # try to make ownership implicit if possible
@@ -346,6 +351,7 @@
 ob = self._getOb(new_id)
 
 notify(ObjectMovedEvent(ob, self, id, self, new_id))
+notifyContainerModified(self)
 
 ob._postCopy(self, op=1)
 

Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===
--- Zope/trunk/lib/python/OFS/ObjectManager.py  2005-11-25 18:47:48 UTC (rev 
40370)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py  2005-11-25 18:50:38 UTC (rev 
40371)
@@ -53,6 +53,8 @@
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
 from zope.app.container.contained import ObjectRemovedEvent
+import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
+from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeAddedEvent
 from OFS.event import ObjectWillBeRemovedEvent
 import OFS.subscribers
@@ -312,6 +314,7 @@
 
 if not suppress_events:
 notify(ObjectAddedEvent(ob, self, id))
+notifyContainerModified(self)
 
 OFS.subscribers.compatibilityCall('manage_afterAdd', ob, ob, self)
 
@@ -360,6 +363,7 @@
 
 if not suppress_events:
 notify(ObjectRemovedEvent(ob, self, id))
+notifyContainerModified(self)
 
 security.declareProtected(access_contents_information, 'objectIds')
 def objectIds(self, spec=None):

Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===
--- Zope/trunk/lib/python/OFS/OrderSupport.py   2005-11-25 18:47:48 UTC (rev 
40370)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py   2005-11-25 18:50:38 UTC (rev 
40371)
@@ -24,6 +24,8 @@
 from DocumentTemplate.sequence import sort
 from Globals import InitializeClass
 from zope.interface import implements
+import Products.Five # BBB: until Zope 3.2 = r40368 is stiched in
+from zope.app.container.contained import notifyContainerModified
 
 from interfaces import IOrderedContainer as z3IOrderedContainer
 from IOrderSupport import IOrderedContainer as z2IOrderedContainer
@@ -135,7 +137,8 @@
 #
 
 security.declareProtected(manage_properties, 'moveObjectsByDelta')
-def moveObjectsByDelta(self, ids, delta, subset_ids=None):
+def moveObjectsByDelta(self, ids, delta, subset_ids=None,
+   suppress_events=False):
  Move specified sub-objects by delta.
 
 if type(ids) is StringType:
@@ -180,6 +183,9 @@
  'not exist.' % subset_ids[pos])
 self._objects = tuple(objects)
 
+if not suppress_events:
+notifyContainerModified(self)
+
 return counter
 
 security.declareProtected(manage_properties, 'moveObjectsUp')
@@ -227,11 +233,12 @@
 raise ValueError('The object with the id %s does not exist.' % id)
 
 security.declareProtected(manage_properties, 'moveObjectToPosition')
-def moveObjectToPosition(self, id, position):
+def moveObjectToPosition(self, id, position, suppress_events=False):
  Move specified object to absolute position.
 
 delta = position - self.getObjectPosition(id)
-return self.moveObjectsByDelta(id, delta)
+return self.moveObjectsByDelta(id, delta,
+   suppress_events=suppress_events)
 
 

[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Products/Five/ Updated to Five 1.3b4.

2005-11-25 Thread Florent Guillaume
Log message for revision 40372:
  Updated to Five 1.3b4.
  
  

Changed:
  U   Zope/branches/2.9/lib/python/Products/Five/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Products/Five/__init__.py
  U   Zope/branches/2.9/lib/python/Products/Five/tests/event.txt
  U   Zope/branches/2.9/lib/python/Products/Five/tests/test_security.py
  U   Zope/branches/2.9/lib/python/Products/Five/version.txt

-=-
Modified: Zope/branches/2.9/lib/python/Products/Five/CHANGES.txt
===
--- Zope/branches/2.9/lib/python/Products/Five/CHANGES.txt  2005-11-25 
18:50:38 UTC (rev 40371)
+++ Zope/branches/2.9/lib/python/Products/Five/CHANGES.txt  2005-11-25 
21:21:52 UTC (rev 40372)
@@ -2,6 +2,16 @@
 Five Changes
 
 
+Five 1.3b4 (2005-11-25)
+===
+
+Restructuring
+-
+
+* Cleaned up security test.
+
+* Made Five send a ContainerModifiedEvent when appropriate.
+
 Five 1.3b3 (2005-11-19)
 ===
 

Modified: Zope/branches/2.9/lib/python/Products/Five/__init__.py
===
--- Zope/branches/2.9/lib/python/Products/Five/__init__.py  2005-11-25 
18:50:38 UTC (rev 40371)
+++ Zope/branches/2.9/lib/python/Products/Five/__init__.py  2005-11-25 
21:21:52 UTC (rev 40372)
@@ -13,13 +13,17 @@
 ##
 Initialize the Five product
 
-$Id: __init__.py 12884 2005-05-30 13:10:41Z philikon $
+$Id: __init__.py 20254 2005-11-25 18:45:08Z efge $
 
 import Acquisition
 from Globals import INSTANCE_HOME
 
+import monkey # BBB: goes away when Zope 3.2 = r40368 is stiched in
 import zcml
 
+# trigger monkey patches
+monkey.monkeyPatch()
+
 # public API provided by Five
 # usage: from Products.Five import something
 from browser import BrowserView

Modified: Zope/branches/2.9/lib/python/Products/Five/tests/event.txt
===
--- Zope/branches/2.9/lib/python/Products/Five/tests/event.txt  2005-11-25 
18:50:38 UTC (rev 40371)
+++ Zope/branches/2.9/lib/python/Products/Five/tests/event.txt  2005-11-25 
21:21:52 UTC (rev 40372)
@@ -105,6 +105,7 @@
   ObjectWillBeAddedEvent sub
   ObjectAddedEvent sub
   old manage_afterAdd sub sub folder
+  ContainerModifiedEvent folder
   'sub'
sub = folder.sub
ob = MyContent('dog')
@@ -112,6 +113,7 @@
   ObjectWillBeAddedEvent dog
   ObjectAddedEvent dog
   old manage_afterAdd dog dog sub
+  ContainerModifiedEvent sub
   'dog'
 
 And when we rename the subfolder, manage_beforeDelete is also called
@@ -126,6 +128,7 @@
   old manage_afterAdd marine marine folder
   ObjectMovedEvent dog
   old manage_afterAdd dog marine folder
+  ContainerModifiedEvent folder
 
 Same thing for clone::
 
@@ -137,6 +140,7 @@
   old manage_afterAdd tank tank folder
   ObjectAddedEvent dog
   old manage_afterAdd dog tank folder
+  ContainerModifiedEvent folder
   ObjectClonedEvent tank
   old manage_afterClone tank tank
   ObjectClonedEvent dog
@@ -161,6 +165,7 @@
   ObjectWillBeAddedEvent lassie
   ObjectAddedEvent lassie
   old manage_afterAdd lassie lassie folder
+  ContainerModifiedEvent folder
   'lassie'
 
 And when we delete the object, manage_beforeDelete is also called and
@@ -170,6 +175,7 @@
   ObjectWillBeRemovedEvent lassie
   old manage_beforeDelete lassie lassie folder
   ObjectRemovedEvent lassie
+  ContainerModifiedEvent folder
 
 The old behavior happens for a move or a copy, with events too.
 For a move::
@@ -179,6 +185,7 @@
   ObjectWillBeAddedEvent blueberry
   ObjectAddedEvent blueberry
   old manage_afterAdd blueberry blueberry folder
+  ContainerModifiedEvent folder
   'blueberry'
cp = folder.manage_cutObjects('blueberry')
folder.manage_pasteObjects(cp)
@@ -186,6 +193,7 @@
   old manage_beforeDelete blueberry blueberry folder
   ObjectMovedEvent blueberry
   old manage_afterAdd blueberry blueberry folder
+  ContainerModifiedEvent folder
   [{'new_id': 'blueberry', 'id': 'blueberry'}]
 
 Old behavior with events for a copy::
@@ -196,6 +204,7 @@
   ObjectWillBeAddedEvent copy_of_blueberry
   ObjectAddedEvent copy_of_blueberry
   old manage_afterAdd copy_of_blueberry copy_of_blueberry folder
+  ContainerModifiedEvent folder
   ObjectClonedEvent copy_of_blueberry
   old manage_afterClone copy_of_blueberry copy_of_blueberry
   [{'new_id': 'copy_of_blueberry', 'id': 'blueberry'}]
@@ -207,6 +216,7 @@
   old manage_beforeDelete copy_of_blueberry copy_of_blueberry folder
   ObjectMovedEvent myrtille
   old manage_afterAdd myrtille myrtille folder
+  ContainerModifiedEvent folder
 
 Old behavior with events for a clone::
 
@@ -215,6 +225,7 @@
   ObjectWillBeAddedEvent strawberry
   ObjectAddedEvent strawberry
   old manage_afterAdd strawberry strawberry folder
+  ContainerModifiedEvent folder
   ObjectClonedEvent strawberry
   old manage_afterClone strawberry strawberry
res.getId()
@@ -227,12 +238,14 

[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/Five/monkey.py Forgotten in Five 1.3b4 merge.

2005-11-25 Thread Florent Guillaume
Log message for revision 40375:
  Forgotten in Five 1.3b4 merge.

Changed:
  A   Zope/trunk/lib/python/Products/Five/monkey.py

-=-
Added: Zope/trunk/lib/python/Products/Five/monkey.py
===
--- Zope/trunk/lib/python/Products/Five/monkey.py   2005-11-25 21:30:04 UTC 
(rev 40374)
+++ Zope/trunk/lib/python/Products/Five/monkey.py   2005-11-25 21:30:39 UTC 
(rev 40375)
@@ -0,0 +1,71 @@
+##
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##
+Bad monkey!
+
+BBB: goes away when Zope 3.2 = r40368 is stiched in
+
+$Id$
+
+def monkeyPatch():
+Trigger all monkey patches needed to make Five work.
+
+Monkey patches are kept to a minimum level.
+
+zope3_monkey()
+
+def zope3_monkey():
+Fix Zope 3 to have the proper ContainerModifiedEvent that has
+been added for 3.2.
+
+try:
+from zope.app.container.contained import notifyContainerModified
+except ImportError:
+pass
+else:
+return
+
+# BBB: goes away when Zope 3.2 = r40368 is stiched in
+
+from zope.event import notify
+from zope.interface import implements
+import zope.app.container.contained
+import zope.app.container.interfaces
+from zope.app.event.objectevent import ObjectModifiedEvent
+from zope.app.event.interfaces import IObjectModifiedEvent
+
+class IContainerModifiedEvent(IObjectModifiedEvent):
+The container has been modified.
+
+This event is specific to containerness modifications, which
+means addition, removal or reordering of sub-objects.
+
+
+zope.app.container.interfaces.IContainerModifiedEvent = \
+IContainerModifiedEvent
+
+
+class ContainerModifiedEvent(ObjectModifiedEvent):
+The container has been modified.
+implements(IContainerModifiedEvent)
+
+zope.app.container.contained.ContainerModifiedEvent = \
+ContainerModifiedEvent
+
+
+def notifyContainerModified(object, *descriptions):
+Notify that the container was modified.
+notify(ContainerModifiedEvent(object, *descriptions))
+
+zope.app.container.contained.notifyContainerModified = \
+notifyContainerModified


Property changes on: Zope/trunk/lib/python/Products/Five/monkey.py
___
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

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


[Zope-Checkins] SVN: Zope/trunk/ Merged r40279 from 2.9 branch:

2005-11-20 Thread Florent Guillaume
Log message for revision 40280:
  Merged r40279 from 2.9 branch:
  
  Warn when an attempt is made to have a security declaration on a
  nonexistent method. Removed one such method.
  
  Fixed unclear security declarations. When bug 761 was fixed,
  declareProtected(perm) was made illegal, at least one method name was
  required. This checkin does the same for declarePrivate() and
  declarePublic().
  
  Also there was a bug in that a class having:
security = ClassSecurityInfo()
__ac_permissions__ = ((perm, ()),)
  was not equivalent to a class having:
__ac_permissions__ = ((perm, ()),)
  This first form had as a buggy side effect have the behavior of
__ac_permissions__ = ((perm, ('')),)
  which is equivalent to
__roles__ = PermissonRole(perm)
  Not it will simply make the permission available from this object
  (with default roles).
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/AccessControl/SecurityInfo.py
  U   Zope/trunk/lib/python/App/class_init.py
  U   Zope/trunk/lib/python/OFS/ZDOM.py
  U   Zope/trunk/lib/python/webdav/Lockable.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-11-20 23:50:04 UTC (rev 40279)
+++ Zope/trunk/doc/CHANGES.txt  2005-11-20 23:54:39 UTC (rev 40280)
@@ -26,6 +26,9 @@
 
 Features added
 
+  - Fixed unclear security declarations. Warn when an attempt is
+made to have a security declaration on a nonexistent method.
+
   - updated to ZPL 2.1
 
   - interfaces: Added 'Interfaces' tab to basic core objects.

Modified: Zope/trunk/lib/python/AccessControl/SecurityInfo.py
===
--- Zope/trunk/lib/python/AccessControl/SecurityInfo.py 2005-11-20 23:50:04 UTC 
(rev 40279)
+++ Zope/trunk/lib/python/AccessControl/SecurityInfo.py 2005-11-20 23:54:39 UTC 
(rev 40280)
@@ -67,9 +67,6 @@
 self.roles = {}
 
 def _setaccess(self, names, access):
-# Empty names list sets access to the class itself, named ''
-if not len(names):
-names = ('',)
 for name in names:
 if self.names.get(name, access) != access:
 LOG('SecurityInfo', WARNING, 'Conflicting security '
@@ -78,14 +75,14 @@
 self.names[name] = access
 
 declarePublic__roles__=ACCESS_PRIVATE
-def declarePublic(self, *names):
+def declarePublic(self, name, *names):
 Declare names to be publicly accessible.
-self._setaccess(names, ACCESS_PUBLIC)
+self._setaccess((name,) + names, ACCESS_PUBLIC)
 
 declarePrivate__roles__=ACCESS_PRIVATE
-def declarePrivate(self, *names):
+def declarePrivate(self, name, *names):
 Declare names to be inaccessible to restricted code.
-self._setaccess(names, ACCESS_PRIVATE)
+self._setaccess((name,) + names, ACCESS_PRIVATE)
 
 declareProtected__roles__=ACCESS_PRIVATE
 def declareProtected(self, permission_name, name, *names):
@@ -95,17 +92,17 @@
 declareObjectPublic__roles__=ACCESS_PRIVATE
 def declareObjectPublic(self):
 Declare the object to be publicly accessible.
-self._setaccess((), ACCESS_PUBLIC)
+self._setaccess(('',), ACCESS_PUBLIC)
 
 declareObjectPrivate__roles__=ACCESS_PRIVATE
 def declareObjectPrivate(self):
 Declare the object to be inaccessible to restricted code.
-self._setaccess((), ACCESS_PRIVATE)
+self._setaccess(('',), ACCESS_PRIVATE)
 
 declareObjectProtected__roles__=ACCESS_PRIVATE
 def declareObjectProtected(self, permission_name):
 Declare the object to be associated with a permission.
-self._setaccess((), permission_name)
+self._setaccess(('',), permission_name)
 
 setPermissionDefault__roles__=ACCESS_PRIVATE
 def setPermissionDefault(self, permission_name, roles):

Modified: Zope/trunk/lib/python/App/class_init.py
===
--- Zope/trunk/lib/python/App/class_init.py 2005-11-20 23:50:04 UTC (rev 
40279)
+++ Zope/trunk/lib/python/App/class_init.py 2005-11-20 23:54:39 UTC (rev 
40280)
@@ -11,6 +11,7 @@
 #
 ##
 
+import logging
 from AccessControl.PermissionRole import PermissionRole
 import AccessControl.Permission
 
@@ -36,7 +37,6 @@
 try: classname = '%s.%s' % (
 self.__module__, self.__name__)
 except AttributeError: classname = `self`
-import logging
 logging.getLogger(Init).warning(
 'Ambiguous name for method of %s: %r != %r',
 classname, d['__name__'], name)
@@ -76,3 +76,8 @@
 pr=PermissionRole(pname)
 for mname in mnames:
 setattr(self, mname+'__roles__', 

[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Merged r40279 from 2.9 branch:

2005-11-20 Thread Florent Guillaume
Log message for revision 40281:
  Merged r40279 from 2.9 branch:
  
  Warn when an attempt is made to have a security declaration on a
  nonexistent method. Removed one such method.
  
  Fixed unclear security declarations. When bug 761 was fixed,
  declareProtected(perm) was made illegal, at least one method name was
  required. This checkin does the same for declarePrivate() and
  declarePublic().
  
  Also there was a bug in that a class having:
security = ClassSecurityInfo()
__ac_permissions__ = ((perm, ()),)
  was not equivalent to a class having:
__ac_permissions__ = ((perm, ()),)
  This first form had as a buggy side effect have the behavior of
__ac_permissions__ = ((perm, ('')),)
  which is equivalent to
__roles__ = PermissonRole(perm)
  Not it will simply make the permission available from this object
  (with default roles).
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py
  U   Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/ZDOM.py
  U   Zope/branches/Zope-2_8-branch/lib/python/webdav/Lockable.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-11-20 23:54:39 UTC 
(rev 40280)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-11-21 00:08:00 UTC 
(rev 40281)
@@ -26,6 +26,9 @@
 
 Bugs Fixed
 
+  - Fixed unclear security declarations. Warn when an attempt is
+made to have a security declaration on a nonexistent method.
+
   - OFS Application: While deprecated since years, old-style product
 metadata in the __init__.py did not show deprecation warnings. Added
 warnings and converted ZGadflyDA/__init__.py and

Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py  
2005-11-20 23:54:39 UTC (rev 40280)
+++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/SecurityInfo.py  
2005-11-21 00:08:00 UTC (rev 40281)
@@ -67,9 +67,6 @@
 self.roles = {}
 
 def _setaccess(self, names, access):
-# Empty names list sets access to the class itself, named ''
-if not len(names):
-names = ('',)
 for name in names:
 if self.names.get(name, access) != access:
 LOG('SecurityInfo', WARNING, 'Conflicting security '
@@ -78,14 +75,14 @@
 self.names[name] = access
 
 declarePublic__roles__=ACCESS_PRIVATE
-def declarePublic(self, *names):
+def declarePublic(self, name, *names):
 Declare names to be publicly accessible.
-self._setaccess(names, ACCESS_PUBLIC)
+self._setaccess((name,) + names, ACCESS_PUBLIC)
 
 declarePrivate__roles__=ACCESS_PRIVATE
-def declarePrivate(self, *names):
+def declarePrivate(self, name, *names):
 Declare names to be inaccessible to restricted code.
-self._setaccess(names, ACCESS_PRIVATE)
+self._setaccess((name,) + names, ACCESS_PRIVATE)
 
 declareProtected__roles__=ACCESS_PRIVATE
 def declareProtected(self, permission_name, name, *names):
@@ -95,17 +92,17 @@
 declareObjectPublic__roles__=ACCESS_PRIVATE
 def declareObjectPublic(self):
 Declare the object to be publicly accessible.
-self._setaccess((), ACCESS_PUBLIC)
+self._setaccess(('',), ACCESS_PUBLIC)
 
 declareObjectPrivate__roles__=ACCESS_PRIVATE
 def declareObjectPrivate(self):
 Declare the object to be inaccessible to restricted code.
-self._setaccess((), ACCESS_PRIVATE)
+self._setaccess(('',), ACCESS_PRIVATE)
 
 declareObjectProtected__roles__=ACCESS_PRIVATE
 def declareObjectProtected(self, permission_name):
 Declare the object to be associated with a permission.
-self._setaccess((), permission_name)
+self._setaccess(('',), permission_name)
 
 setPermissionDefault__roles__=ACCESS_PRIVATE
 def setPermissionDefault(self, permission_name, roles):

Modified: Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py  2005-11-20 
23:54:39 UTC (rev 40280)
+++ Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py  2005-11-21 
00:08:00 UTC (rev 40281)
@@ -11,6 +11,7 @@
 #
 ##
 
+import logging
 from AccessControl.PermissionRole import PermissionRole
 import AccessControl.Permission
 
@@ -36,7 +37,6 @@
 try: classname = '%s.%s' % (
 self.__module__, self.__name__)
 except 

[Zope-Checkins] SVN: Zope/branches/efge-five-events-work/lib/python/OFS/subscribers.py Move code around a bit.

2005-11-10 Thread Florent Guillaume
Log message for revision 40024:
  Move code around a bit.
  

Changed:
  U   Zope/branches/efge-five-events-work/lib/python/OFS/subscribers.py

-=-
Modified: Zope/branches/efge-five-events-work/lib/python/OFS/subscribers.py
===
--- Zope/branches/efge-five-events-work/lib/python/OFS/subscribers.py   
2005-11-10 13:06:53 UTC (rev 40023)
+++ Zope/branches/efge-five-events-work/lib/python/OFS/subscribers.py   
2005-11-10 13:41:15 UTC (rev 40024)
@@ -139,12 +139,12 @@
 def callManageBeforeDelete(ob, item, container):
 Compatibility subscriber for manage_beforeDelete.
 
+if container is None:
+return
 if getattr(aq_base(ob), 'manage_beforeDelete', None) is None:
 return
-if container is None:
-return
+maybeWarnDeprecated(ob, 'manage_beforeDelete')
 import OFS.ObjectManager # avoid circular imports
-maybeWarnDeprecated(ob, 'manage_beforeDelete')
 try:
 ob.manage_beforeDelete(item, container)
 except OFS.ObjectManager.BeforeDeleteException:

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


[Zope-Checkins] SVN: Zope/branches/efge-five-events-work/ Banch has been merged.

2005-11-10 Thread Florent Guillaume
Log message for revision 40031:
  Banch has been merged.

Changed:
  D   Zope/branches/efge-five-events-work/

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


[Zope-Checkins] SVN: Zope/trunk/ Use a better __repr__ for User objects.

2005-11-09 Thread Florent Guillaume
Log message for revision 40006:
  Use a better __repr__ for User objects.
  
  (NullUnrestrictedUser had a non-string repr that made it impossible to
  debug properly.)
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/AccessControl/User.py
  U   Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-11-09 19:39:45 UTC (rev 40005)
+++ Zope/trunk/doc/CHANGES.txt  2005-11-09 19:53:08 UTC (rev 40006)
@@ -86,6 +86,8 @@
 
 Other
 
+  - AccessControl.User: Use a better __repr__.
+
   - ZSQLMethod.manage_main: Moved the error message that warns of a
 non-existing or closed database connection next to the Connection ID
 dropdown and present it using red to increase its visibility.

Modified: Zope/trunk/lib/python/AccessControl/User.py
===
--- Zope/trunk/lib/python/AccessControl/User.py 2005-11-09 19:39:45 UTC (rev 
40005)
+++ Zope/trunk/lib/python/AccessControl/User.py 2005-11-09 19:53:08 UTC (rev 
40006)
@@ -276,7 +276,8 @@
 
 def __len__(self): return 1
 def __str__(self): return self.getUserName()
-__repr__=__str__
+def __repr__(self):
+return '%s %r' % (self.__class__.__name__, self.getUserName())
 
 
 class SimpleUser(BasicUser):

Modified: Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py
===
--- Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py 2005-11-09 
19:39:45 UTC (rev 40005)
+++ Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py 2005-11-09 
19:53:08 UTC (rev 40006)
@@ -275,7 +275,22 @@
 f = User('chris', '123', ['Manager'], [])
 self.assertEqual(f.getDomains(), ())
 
+def testRepr(self):
+f = User('flo', '123', ['Manager'], [])
+self.assertEqual(repr(f), User 'flo')
 
+def testReprSpecial(self):
+from AccessControl.User import NullUnrestrictedUser
+from AccessControl.User import nobody
+from AccessControl.User import system
+# NullUnrestrictedUser is used when there is no emergency user
+self.assertEqual(repr(NullUnrestrictedUser()),
+ NullUnrestrictedUser (None, None))
+self.assertEqual(repr(nobody),
+ SpecialUser 'Anonymous User')
+self.assertEqual(repr(system),
+ UnrestrictedUser 'System Processes')
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(UserFolderTests))

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


[Zope-Checkins] SVN: Zope/branches/efge-five-events-work/ Branch to fix events with Five.

2005-11-09 Thread Florent Guillaume
Log message for revision 40012:
  Branch to fix events with Five.
  

Changed:
  A   Zope/branches/efge-five-events-work/

-=-
Copied: Zope/branches/efge-five-events-work (from rev 40011, Zope/trunk)

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


[Zope-Checkins] SVN: Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py Work correctly with event dispatching:

2005-11-02 Thread Florent Guillaume
Log message for revision 39820:
  Work correctly with event dispatching:
  - mark a test class as deprecated,
  - use a container class that implements IItem.
  
  

Changed:
  U   
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: 
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py
===
--- 
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py
 2005-11-01 17:49:19 UTC (rev 39819)
+++ 
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py
 2005-11-01 18:44:03 UTC (rev 39820)
@@ -48,7 +48,15 @@
 raise DeleteFailed
 return SimpleItem.manage_beforeDelete(self, item, container)
 
+from Products.Five.eventconfigure import setDeprecatedManageAddDelete
+setDeprecatedManageAddDelete(ItemForDeletion)
 
+from zope.interface import implements
+from OFS.interfaces import IItem
+class ObjectManagerWithIItem(ObjectManager):
+The event subscribers work on IItem.
+implements(IItem)
+
 class ObjectManagerTests( unittest.TestCase ):
 
 def setUp(self):
@@ -62,11 +70,8 @@
 getConfiguration().debug_mode = mode
 
 def _getTargetClass( self ):
+return ObjectManagerWithIItem
 
-from OFS.ObjectManager import ObjectManager
-
-return ObjectManager
-
 def _makeOne( self, *args, **kw ):
 
 return self._getTargetClass()( *args, **kw ).__of__( FauxRoot() )

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


[Zope-Checkins] SVN: Zope/branches/philikon-zope32-integration/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py Move code inside try/except.

2005-11-02 Thread Florent Guillaume
Log message for revision 39829:
  Move code inside try/except.
  

Changed:
  U   
Zope/branches/philikon-zope32-integration/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py

-=-
Modified: 
Zope/branches/philikon-zope32-integration/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
===
--- 
Zope/branches/philikon-zope32-integration/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
2005-11-01 21:26:30 UTC (rev 39828)
+++ 
Zope/branches/philikon-zope32-integration/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
2005-11-01 21:31:49 UTC (rev 39829)
@@ -21,11 +21,11 @@
 def setUp(self):
 transaction.begin()
 self.app = makerequest(Zope2.app())
-if not hasattr(self.app, 'error_log'):
-# If ZopeLite was imported, we have no default error_log
-from Products.SiteErrorLog.SiteErrorLog import SiteErrorLog
-self.app._setObject('error_log', SiteErrorLog())
 try:
+if not hasattr(self.app, 'error_log'):
+# If ZopeLite was imported, we have no default error_log
+from Products.SiteErrorLog.SiteErrorLog import SiteErrorLog
+self.app._setObject('error_log', SiteErrorLog())
 self.app.manage_addDTMLMethod('doc', '')
 except:
 self.tearDown()

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


[Zope-Checkins] SVN: Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py Don't recurse explicitely, and shut up deprecation warnings.

2005-11-02 Thread Florent Guillaume
Log message for revision 39835:
  Don't recurse explicitely, and shut up deprecation warnings.
  

Changed:
  U   
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: 
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py
===
--- 
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py
 2005-11-01 23:23:14 UTC (rev 39834)
+++ 
Zope/branches/philikon-zope32-integration/lib/python/OFS/tests/testObjectManager.py
 2005-11-01 23:44:21 UTC (rev 39835)
@@ -46,8 +46,13 @@
 self.before_delete_called = True
 if self.fail_on_delete:
 raise DeleteFailed
-return SimpleItem.manage_beforeDelete(self, item, container)
 
+def manage_afterAdd(self, item, container):
+pass
+
+def manage_afterClone(self, item):
+pass
+
 from Products.Five.eventconfigure import setDeprecatedManageAddDelete
 setDeprecatedManageAddDelete(ItemForDeletion)
 

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


[Zope-Checkins] SVN: Zope/branches/philikon-zope32-integration/lib/python/ Moved more stuff from Five into Zope itself.

2005-11-02 Thread Florent Guillaume
Log message for revision 39846:
  Moved more stuff from Five into Zope itself.
  Event interfaces are now in OFS.interfaces.
  IFiveObjectClonedEvent has been renamed into IObjectClonedEvent.
  
  

Changed:
  U   Zope/branches/philikon-zope32-integration/lib/python/OFS/CopySupport.py
  U   Zope/branches/philikon-zope32-integration/lib/python/OFS/ObjectManager.py
  U   Zope/branches/philikon-zope32-integration/lib/python/OFS/SimpleItem.py
  A   Zope/branches/philikon-zope32-integration/lib/python/OFS/event.py
  U   Zope/branches/philikon-zope32-integration/lib/python/OFS/interfaces.py
  A   Zope/branches/philikon-zope32-integration/lib/python/OFS/subscribers.py
  U   
Zope/branches/philikon-zope32-integration/lib/python/Products/BTreeFolder2/BTreeFolder2.py

-=-
Modified: 
Zope/branches/philikon-zope32-integration/lib/python/OFS/CopySupport.py
===
--- Zope/branches/philikon-zope32-integration/lib/python/OFS/CopySupport.py 
2005-11-02 14:30:36 UTC (rev 39845)
+++ Zope/branches/philikon-zope32-integration/lib/python/OFS/CopySupport.py 
2005-11-02 14:51:27 UTC (rev 39846)
@@ -33,8 +33,9 @@
 from zope.event import notify
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.container.contained import ObjectMovedEvent
-from Products.Five.event import ObjectWillBeMovedEvent
-from Products.Five.event import FiveObjectClonedEvent
+from OFS.event import ObjectWillBeMovedEvent
+from OFS.event import ObjectClonedEvent
+import OFS.subscribers
 
 from OFS.interfaces import ICopyContainer
 from OFS.interfaces import ICopySource
@@ -160,12 +161,9 @@
 previous call to manage_cutObjects or manage_copyObjects as the first
 argument.
 
-Also sends IObjectCopiedEvent and IFiveObjectClonedEvent
+Also sends IObjectCopiedEvent and IObjectClonedEvent
 or IObjectWillBeMovedEvent and IObjectMovedEvent.
 
-# Done here to avoid circular imports
-from Products.Five.subscribers import maybeCallDeprecated
-
 if cb_copy_data is not None:
 cp = cb_copy_data
 elif REQUEST is not None and REQUEST.has_key('__cp'):
@@ -224,9 +222,9 @@
 
 ob._postCopy(self, op=0)
 
-maybeCallDeprecated('manage_afterClone', ob)
+OFS.subscribers.maybeCallDeprecated('manage_afterClone', ob)
 
-notify(FiveObjectClonedEvent(ob))
+notify(ObjectClonedEvent(ob))
 
 if REQUEST is not None:
 return self.manage_main(self, REQUEST, update_menu=1,
@@ -359,9 +357,6 @@
 def manage_clone(self, ob, id, REQUEST=None):
 Clone an object, creating a new object with the given id.
 
-# Done here to avoid circular imports
-from Products.Five.subscribers import maybeCallDeprecated
-
 if not ob.cb_isCopyable():
 raise CopyError, eNotSupported % escape(ob.getId())
 try:
@@ -393,9 +388,9 @@
 
 ob._postCopy(self, op=0)
 
-maybeCallDeprecated('manage_afterClone', ob)
+OFS.subscribers.maybeCallDeprecated('manage_afterClone', ob)
 
-notify(FiveObjectClonedEvent(ob))
+notify(ObjectClonedEvent(ob))
 
 return ob
 

Modified: 
Zope/branches/philikon-zope32-integration/lib/python/OFS/ObjectManager.py
===
--- Zope/branches/philikon-zope32-integration/lib/python/OFS/ObjectManager.py   
2005-11-02 14:30:36 UTC (rev 39845)
+++ Zope/branches/philikon-zope32-integration/lib/python/OFS/ObjectManager.py   
2005-11-02 14:51:27 UTC (rev 39846)
@@ -46,8 +46,9 @@
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
 from zope.app.container.contained import ObjectRemovedEvent
-from Products.Five.event import ObjectWillBeAddedEvent
-from Products.Five.event import ObjectWillBeRemovedEvent
+from OFS.event import ObjectWillBeAddedEvent
+from OFS.event import ObjectWillBeRemovedEvent
+import OFS.subscribers
 
 
 # the name BadRequestException is relied upon by 3rd-party code
@@ -278,9 +279,6 @@
 
 Also sends IObjectWillBeAddedEvent and IObjectAddedEvent.
 
-# Done here to avoid circular imports
-from Products.Five.subscribers import maybeCallDeprecated
-
 ob = object # better name, keep original function signature
 v = self._checkId(id)
 if v is not None:
@@ -317,7 +315,7 @@
 if not suppress_events:
 notify(ObjectAddedEvent(ob, self, id))
 
-maybeCallDeprecated('manage_afterAdd', ob, self)
+OFS.subscribers.maybeCallDeprecated('manage_afterAdd', ob, self)
 
 return id
 
@@ -334,7 +332,7 @@
 # Don't do recursion anymore, a subscriber does that.
 warnings.warn(
 %s.manage_afterClone is deprecated and will be removed in 
-Zope 2.11, you should use an IFiveObjectClonedEvent 
+  

[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Collector #1926: fixed a typo in _doAddUser when password encryption is

2005-10-20 Thread Florent Guillaume
Log message for revision 39540:
  Collector #1926: fixed a typo in _doAddUser when password encryption is
  enabled.
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/AccessControl/User.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-10-20 15:07:29 UTC 
(rev 39539)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-10-21 00:06:17 UTC 
(rev 39540)
@@ -22,6 +22,13 @@
 
- Collector #1233: port ZOPE_CONFIG patch from Zope 2.7 to Zope 2.8
 
+  After Zope 2.8.3
+
+Bugs Fixed
+
+  - Collector #1926: fixed a typo in _doAddUser when password
+encryption is enabled.
+
   Zope 2.8.3 (2005/10/18)
 
 Other

Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/User.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/User.py  
2005-10-20 15:07:29 UTC (rev 39539)
+++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/User.py  
2005-10-21 00:06:17 UTC (rev 39540)
@@ -1045,7 +1045,7 @@
 def _doAddUser(self, name, password, roles, domains, **kw):
 Create a new user
 if password is not None and self.encrypt_passwords \
-   and not self._isPasswordEncrypted(pw):
+   and not self._isPasswordEncrypted(password):
 password = self._encryptPassword(password)
 self.data[name]=User(name,password,roles,domains)
 

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ The '@' character is now allowed in object ids (RFC 1738 allows it).

2005-10-04 Thread Florent Guillaume
Log message for revision 38738:
  The '@' character is now allowed in object ids (RFC 1738 allows it).
  Expanded tests for _checkId.
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-10-04 10:06:48 UTC 
(rev 38737)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-10-04 11:02:52 UTC 
(rev 38738)
@@ -29,6 +29,8 @@
   - Collector #1118: Added syntax to dtml-sqlgroup to support flexible
 generation of 'UPDATE' statements (bounty sponsored by Logicalware).
 
+  - The '@' character is now allowed in object ids (RFC 1738 allows it).
+
 Bugs Fixed
 
   - Collector #1863: Prevent possibly sensitive information to leak via

Modified: Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py   
2005-10-04 10:06:48 UTC (rev 38737)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py   
2005-10-04 11:02:52 UTC (rev 38738)
@@ -49,7 +49,7 @@
 XMLExportImport.magic: XMLExportImport.importXML,
 }
 
-bad_id=re.compile(r'[^a-zA-Z0-9-_~,.$\(\)# ]').search #TS
+bad_id=re.compile(r'[^a-zA-Z0-9-_~,.$\(\)# @]').search
 
 def checkValidId(self, id, allow_dup=0):
 # If allow_dup is false, an error will be raised if an object

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py 
2005-10-04 10:06:48 UTC (rev 38737)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py 
2005-10-04 11:02:52 UTC (rev 38738)
@@ -303,6 +303,41 @@
 om2._setObject(ob.getId(), ob)
 self.assertRaises(DeleteFailed, om1._delObject, 'om2')
 
+def test_setObject_checkId_ok(self):
+om = self._makeOne()
+si = SimpleItem('1')
+om._setObject('AB-dash_under0123', si)
+si = SimpleItem('2')
+om._setObject('ho.bak~', si)
+si = SimpleItem('3')
+om._setObject('dot.comma,dollar$(hi)hash# space', si)
+si = SimpleItem('4')
+om._setObject('[EMAIL PROTECTED]', si)
+si = SimpleItem('5')
+om._setObject('..haha', si)
+si = SimpleItem('6')
+om._setObject('.bashrc', si)
+
+def test_setObject_checkId_bad(self):
+from zExceptions import BadRequest
+om = self._makeOne()
+si = SimpleItem('111')
+om._setObject('111', si)
+si = SimpleItem('2')
+self.assertRaises(BadRequest, om._setObject, 123, si)
+self.assertRaises(BadRequest, om._setObject, 'a\x01b', si)
+self.assertRaises(BadRequest, om._setObject, 'a\\b', si)
+self.assertRaises(BadRequest, om._setObject, 'a:b', si)
+self.assertRaises(BadRequest, om._setObject, 'a;b', si)
+self.assertRaises(BadRequest, om._setObject, '.', si)
+self.assertRaises(BadRequest, om._setObject, '..', si)
+self.assertRaises(BadRequest, om._setObject, '_foo', si)
+self.assertRaises(BadRequest, om._setObject, 'aq_me', si)
+self.assertRaises(BadRequest, om._setObject, 'bah__', si)
+self.assertRaises(BadRequest, om._setObject, '111', si)
+self.assertRaises(BadRequest, om._setObject, 'REQUEST', si)
+self.assertRaises(BadRequest, om._setObject, '/', si)
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest( unittest.makeSuite( ObjectManagerTests ) )

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py Additional test. CMF requires this behaviour.

2005-08-01 Thread Florent Guillaume
Log message for revision 37625:
  Additional test. CMF requires this behaviour.
  

Changed:
  U   
Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py

-=-
Modified: 
Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
===
--- 
Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py   
2005-08-01 15:13:08 UTC (rev 37624)
+++ 
Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py   
2005-08-01 16:02:49 UTC (rev 37625)
@@ -216,7 +216,18 @@
 lst = list(res[0].keys())
 self.assertEqual(lst,results)
 
+def testQueryPathReturnedInResult(self):
 
+index = self._index
+index.index_object(1, Dummy(/ff))
+index.index_object(2, Dummy(/ff/gg))
+index.index_object(3, Dummy(/ff/gg/3.html))
+index.index_object(4, Dummy(/ff/gg/4.html))
+res = index._apply_index({'path': {'query': '/ff/gg'}})
+lst = list(res[0].keys())
+self.assertEqual(lst, [2, 3, 4])
+
+
 def test_suite():
 return unittest.TestSuite((
 unittest.makeSuite(PathIndexTests),

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/AccessControl/Owned.py Display offending line when warning about getOwner(1) deprecation.

2005-08-01 Thread Florent Guillaume
Log message for revision 37633:
  Display offending line when warning about getOwner(1) deprecation.
  

Changed:
  U   Zope/trunk/lib/python/AccessControl/Owned.py

-=-
Modified: Zope/trunk/lib/python/AccessControl/Owned.py
===
--- Zope/trunk/lib/python/AccessControl/Owned.py2005-08-01 20:05:59 UTC 
(rev 37632)
+++ Zope/trunk/lib/python/AccessControl/Owned.py2005-08-01 20:08:03 UTC 
(rev 37633)
@@ -82,7 +82,7 @@
 import warnings
 warnings.warn('Owned.getOwner(1) is deprecated; '
   'please use getOwnerTuple() instead.',
-  DeprecationWarning)
+  DeprecationWarning, stacklevel=2)
 
 
 owner=aq_get(self, '_owner', None, 1)

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


[Zope-Checkins] CVS: Packages/AccessControl - Owned.py:1.19.46.5

2005-08-01 Thread Florent Guillaume
Update of /cvs-repository/Packages/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv8

Modified Files:
  Tag: Zope-2_7-branch
Owned.py 
Log Message:
Merge from 37633 on trunk:
Display offending line when warning about getOwner(1) deprecation.


=== Packages/AccessControl/Owned.py 1.19.46.4 = 1.19.46.5 ===
--- Packages/AccessControl/Owned.py:1.19.46.4   Fri Mar 12 11:58:29 2004
+++ Packages/AccessControl/Owned.py Mon Aug  1 16:09:15 2005
@@ -76,7 +76,7 @@
 import warnings
 warnings.warn('Owned.getOwner(1) is deprecated; '
   'please use getOwnerTuple() instead.',
-  DeprecationWarning)
+  DeprecationWarning, stacklevel=2)
 
 
 owner=aq_get(self, '_owner', None, 1)

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py Merge from 37625 on trunk:

2005-08-01 Thread Florent Guillaume
Log message for revision 37638:
  Merge from 37625 on trunk:
  
  Additional test. CMF requires this behaviour.
  
  

Changed:
  U   
Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py

-=-
Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
===
--- 
Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
2005-08-01 20:15:07 UTC (rev 37637)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
2005-08-01 20:16:54 UTC (rev 37638)
@@ -216,7 +216,18 @@
 lst = list(res[0].keys())
 self.assertEqual(lst,results)
 
+def testQueryPathReturnedInResult(self):
 
+index = self._index
+index.index_object(1, Dummy(/ff))
+index.index_object(2, Dummy(/ff/gg))
+index.index_object(3, Dummy(/ff/gg/3.html))
+index.index_object(4, Dummy(/ff/gg/4.html))
+res = index._apply_index({'path': {'query': '/ff/gg'}})
+lst = list(res[0].keys())
+self.assertEqual(lst, [2, 3, 4])
+
+
 def test_suite():
 return unittest.TestSuite((
 unittest.makeSuite(PathIndexTests),

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Zope.py Put warning on a single line.

2005-07-27 Thread Florent Guillaume
Log message for revision 37481:
  Put warning on a single line.
  

Changed:
  U   Zope/trunk/lib/python/Zope.py

-=-
Modified: Zope/trunk/lib/python/Zope.py
===
--- Zope/trunk/lib/python/Zope.py   2005-07-27 13:38:39 UTC (rev 37480)
+++ Zope/trunk/lib/python/Zope.py   2005-07-27 13:56:04 UTC (rev 37481)
@@ -20,8 +20,7 @@
 sys.modules['Zope'] = Zope2
 
 import warnings
-warnings.warn(The Zope package has been renamed to Zope2.\n
-  Import of a package named 'Zope' is deprecated\n
-  and will be disabled starting in Zope 2.11.\n
-  ,
+warnings.warn(The Zope package has been renamed to Zope2. 
+  Import of a package named 'Zope' is deprecated 
+  and will be disabled starting in Zope 2.11.,
   DeprecationWarning, stacklevel=2)

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Zope.py Put warning on a single line.

2005-07-27 Thread Florent Guillaume
Log message for revision 37482:
  Put warning on a single line.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Zope.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Zope.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/Zope.py2005-07-27 13:56:04 UTC 
(rev 37481)
+++ Zope/branches/Zope-2_8-branch/lib/python/Zope.py2005-07-27 13:58:22 UTC 
(rev 37482)
@@ -20,8 +20,7 @@
 sys.modules['Zope'] = Zope2
 
 import warnings
-warnings.warn(The Zope package has been renamed to Zope2.\n
-  Import of a package named 'Zope' is deprecated\n
-  and will be disabled starting in Zope 2.11.\n
-  ,
+warnings.warn(The Zope package has been renamed to Zope2. 
+  Import of a package named 'Zope' is deprecated 
+  and will be disabled starting in Zope 2.11.,
   DeprecationWarning, stacklevel=2)

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


Re: [Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - Collector #1792: applied patch for broken ZClasses

2005-06-13 Thread Florent Guillaume
 Modified: Zope/branches/Zope-2_8-branch/lib/python/ZClasses/_pmc.py
 ===
 --- Zope/branches/Zope-2_8-branch/lib/python/ZClasses/_pmc.py 2005-06-10 
 23:57:01 UTC (rev
 30750)
 +++ Zope/branches/Zope-2_8-branch/lib/python/ZClasses/_pmc.py 2005-06-11 
 06:20:42 UTC (rev
 30751)
 @@ -56,15 +56,20 @@
  ExtensionClass.pmc_init_of(result)
  return result
  
 +# copy_reg.py:_slotnames() tries to use this attribute as a cache.
 +# Dont allow this attribute to be written as it may cause us
 +# to register with the data_manager.
 +__slotnames__ = property(None)
 +
  def __setattr__(self, name, v):
 +super(ZClassPersistentMetaClass, self).__setattr__(name, v)
  if not ((name.startswith('_p_') or name.startswith('_v'))):
  self._p_maybeupdate(name)
 -super(ZClassPersistentMetaClass, self).__setattr__(name, v)

Not caused by this patch, but shouldn't this be '_v_' instead of '_v' ?
ZODB/persistentclass.py has the same code, by the way...

Florent

  
  def __delattr__(self, name):
 +super(ZClassPersistentMetaClass, self).__delattr__(name)
  if not ((name.startswith('_p_') or name.startswith('_v'))):
  self._p_maybeupdate(name)
 -super(ZClassPersistentMetaClass, self).__delattr__(name)
  


-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py Fixed unit test.

2005-06-01 Thread Florent Guillaume
Log message for revision 30588:
  Fixed unit test.

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py

-=-
Modified: 
Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py 
2005-05-31 22:54:13 UTC (rev 30587)
+++ Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py 
2005-06-01 10:27:10 UTC (rev 30588)
@@ -375,8 +375,8 @@
 
 def testStrftimeUnicode(self):
 dt = DateTime('2002-05-02T08:00:00+00:00')
-self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'),
- u'Le 02/05/2002 \xe0 10h00')
+ok = dt.strftime('Le %d/%m/%Y a %Hh%M').replace('a', u'\xe0')
+self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), ok)
 
 def test_suite():
 return unittest.makeSuite(DateTimeTests)

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/tests/testDateTime.py Fixed unit test.

2005-06-01 Thread Florent Guillaume
Log message for revision 30589:
  Fixed unit test.

Changed:
  U   Zope/trunk/lib/python/DateTime/tests/testDateTime.py

-=-
Modified: Zope/trunk/lib/python/DateTime/tests/testDateTime.py
===
--- Zope/trunk/lib/python/DateTime/tests/testDateTime.py2005-06-01 
10:27:10 UTC (rev 30588)
+++ Zope/trunk/lib/python/DateTime/tests/testDateTime.py2005-06-01 
10:28:40 UTC (rev 30589)
@@ -375,8 +375,8 @@
 
 def testStrftimeUnicode(self):
 dt = DateTime('2002-05-02T08:00:00+00:00')
-self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'),
- u'Le 02/05/2002 \xe0 10h00')
+ok = dt.strftime('Le %d/%m/%Y a %Hh%M').replace('a', u'\xe0')
+self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), ok)
 
 def test_suite():
 return unittest.makeSuite(DateTimeTests)

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py Added test for strftime with unicode pattern.

2005-05-31 Thread Florent Guillaume
Log message for revision 30570:
  Added test for strftime with unicode pattern.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py

-=-
Modified: 
Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py 
2005-05-31 14:30:17 UTC (rev 30569)
+++ Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py 
2005-05-31 14:58:17 UTC (rev 30570)
@@ -373,7 +373,10 @@
 dt2 = DateTime('2040/01/30 11:33 GMT-2')
 self.assertEqual(dt1.strftime('%d/%m/%Y %H:%M'), 
dt2.strftime('%d/%m/%Y %H:%M'))
 
-
+def testStrftimeUnicode(self):
+dt = DateTime('2002-05-02T08:00:00+00:00')
+self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'),
+ u'Le 02/05/2002 \xe0 10h00')
 
 def test_suite():
 return unittest.makeSuite(DateTimeTests)

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/tests/testDateTime.py Merged revision 30570 from Zope-2_8-branch:

2005-05-31 Thread Florent Guillaume
Log message for revision 30571:
  Merged revision 30570 from Zope-2_8-branch:
  
  Added test for strftime with unicode pattern.
  

Changed:
  U   Zope/trunk/lib/python/DateTime/tests/testDateTime.py

-=-
Modified: Zope/trunk/lib/python/DateTime/tests/testDateTime.py
===
--- Zope/trunk/lib/python/DateTime/tests/testDateTime.py2005-05-31 
14:58:17 UTC (rev 30570)
+++ Zope/trunk/lib/python/DateTime/tests/testDateTime.py2005-05-31 
16:00:54 UTC (rev 30571)
@@ -373,7 +373,10 @@
 dt2 = DateTime('2040/01/30 11:33 GMT-2')
 self.assertEqual(dt1.strftime('%d/%m/%Y %H:%M'), 
dt2.strftime('%d/%m/%Y %H:%M'))
 
-
+def testStrftimeUnicode(self):
+dt = DateTime('2002-05-02T08:00:00+00:00')
+self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'),
+ u'Le 02/05/2002 \xe0 10h00')
 
 def test_suite():
 return unittest.makeSuite(DateTimeTests)

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