[Zope-Checkins] SVN: Zope/branches/2.13/src/Products/Five/browser/ Fix test errors for unicode id fixes.

2013-02-20 Thread Wichert Akkerman
Log message for revision 129542:
  Fix test errors for unicode id fixes.

Changed:
  U   Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py
  U   Zope/branches/2.13/src/Products/Five/browser/tests/pages.txt
  U   Zope/branches/2.13/src/Products/Five/browser/tests/test_menu.py

-=-
Modified: Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py
===
--- Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py   
2013-02-20 15:19:31 UTC (rev 129541)
+++ Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py   
2013-02-20 15:23:10 UTC (rev 129542)
@@ -195,6 +195,8 @@
 (_context, name, for_, permission, layer, class_,
  allowed_interface, allowed_attributes) = self.args
 
+name = str(name)  # De-unicode
+
 required = {}
 
 cdict = {}

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/pages.txt
===
--- Zope/branches/2.13/src/Products/Five/browser/tests/pages.txt
2013-02-20 15:19:31 UTC (rev 129541)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/pages.txt
2013-02-20 15:23:10 UTC (rev 129542)
@@ -87,15 +87,15 @@
   Products.Five.metaclass.NewStyleClass ...
   
 Both browser:view and browser:page are ILocation providers, so make sure they
-have a __name__ attribute:
+have a __name__ attribute with a str instance:
 
page = self.folder.unrestrictedTraverse('testoid/eagle.txt')
page.__name__
-  u'eagle.txt'
+  'eagle.txt'
 
view = self.folder.unrestrictedTraverse('testoid/named_view')
view.__name__
-  u'named_view'
+  'named_view'
 
 ZPT-based browser pages
 ---

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/test_menu.py
===
--- Zope/branches/2.13/src/Products/Five/browser/tests/test_menu.py 
2013-02-20 15:19:31 UTC (rev 129541)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/test_menu.py 
2013-02-20 15:23:10 UTC (rev 129542)
@@ -49,7 +49,7 @@
menu.sort(lambda x, y: cmp(x['title'], y['title']))
from pprint import pprint
pprint(menu[0])
-  {'action': u'@@cockatiel_menu_public.html',
+  {'action': '@@cockatiel_menu_public.html',
'description': u'',
'extra': None,
'icon': None,
@@ -100,7 +100,7 @@
 
menu.sort(lambda x, y: cmp(x['title'], y['title']))
pprint(menu[0])
-  {'action': u'@@cockatiel_menu_protected.html',
+  {'action': '@@cockatiel_menu_protected.html',
'description': u'',
'extra': None,
'icon': None,
@@ -109,7 +109,7 @@
'title': u'Page in a menu (protected)'}
 
pprint(menu[1])
-  {'action': u'@@cockatiel_menu_public.html',
+  {'action': '@@cockatiel_menu_public.html',
'description': u'',
'extra': None,
'icon': None,

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


[Zope-Checkins] SVN: Zope/branches/2.13/ Use str __name__ for generated simple view classes.

2013-02-18 Thread Wichert Akkerman
Log message for revision 129447:
  Use str __name__ for generated simple view classes.
  
  This fixes LP #1129030
  

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  U   Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2013-02-18 08:42:10 UTC (rev 129446)
+++ Zope/branches/2.13/doc/CHANGES.rst  2013-02-18 13:55:48 UTC (rev 129447)
@@ -8,6 +8,9 @@
 2.13.20 (unreleased)
 
 
+- Make sure the generated classes for simple browser pages (SimpleViewClasses)
+  have a str __name__. See LP #1129030.
+
 - In PageTemplate.pt_errors accept the check_macro_expansion argument.
   This is added for compatibility with zope.pagetemplate 4.0.0.  The
   argument is ignored.  See LP #732972.

Modified: Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py
===
--- Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py   
2013-02-18 08:42:10 UTC (rev 129446)
+++ Zope/branches/2.13/src/Products/Five/browser/metaconfigure.py   
2013-02-18 13:55:48 UTC (rev 129447)
@@ -59,6 +59,7 @@
  attribute='__call__', menu=None, title=None,
  ):
 
+name = str(name)  # De-unicode
 _handle_menu(_context, menu, title, [for_], name, permission)
 
 if not (class_ or template):

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


[Zope-Checkins] SVN: Zope/trunk/ Use str __name__ for generated simple view classes.

2013-02-18 Thread Wichert Akkerman
Log message for revision 129448:
  Use str __name__ for generated simple view classes.
  
  This fixes LP #1129030
  M
  

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

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2013-02-18 13:55:48 UTC (rev 129447)
+++ Zope/trunk/doc/CHANGES.rst  2013-02-18 14:00:53 UTC (rev 129448)
@@ -11,6 +11,9 @@
 Bugs Fixed
 ++
 
+- Make sure the generated classes for simple browser pages (SimpleViewClasses)
+  have a str __name__. See LP #1129030.
+
 - In ``PageTemplate.pt_errors`` accept the ``check_macro_expansion`` argument.
   This is added for compatibility with ``zope.pagetemplate`` 4.0.0.
   The argument is ignored (LP #732972).

Modified: Zope/trunk/src/Products/Five/browser/metaconfigure.py
===
--- Zope/trunk/src/Products/Five/browser/metaconfigure.py   2013-02-18 
13:55:48 UTC (rev 129447)
+++ Zope/trunk/src/Products/Five/browser/metaconfigure.py   2013-02-18 
14:00:53 UTC (rev 129448)
@@ -92,6 +92,7 @@
  allowed_interface=None, allowed_attributes=None,
  attribute='__call__', menu=None, title=None, 
  ):
+name = str(name)  # De-unicode
 _handle_menu(_context, menu, title, [for_], name, permission, layer)
 required = {}
 
@@ -452,7 +453,7 @@
 
 
 # Original version: zope.browserpage.simpleviewclass.SimpleViewClass
-def SimpleViewClass(src, offering=None, used_for=None, bases=(), name=u''):
+def SimpleViewClass(src, offering=None, used_for=None, bases=(), name=''):
 if offering is None:
 offering = sys._getframe(1).f_globals
 

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


[Zope-Checkins] SVN: Zope/branches/wichert-ofs-paste-naming/ Pass object to CopyContainer._get_id

2013-01-11 Thread Wichert Akkerman
Log message for revision 129036:
  Pass object to CopyContainer._get_id
  
  Modify OFS.CopySupport.CopyContainer to pass the object to _get_id as well,
  allowing for more flexible id generation logic such as using INameChooser.
  

Changed:
  A   Zope/branches/wichert-ofs-paste-naming/
  U   Zope/branches/wichert-ofs-paste-naming/doc/CHANGES.rst
  U   Zope/branches/wichert-ofs-paste-naming/src/OFS/CopySupport.py
  U   Zope/branches/wichert-ofs-paste-naming/src/OFS/tests/testCopySupport.py

-=-
Modified: Zope/branches/wichert-ofs-paste-naming/doc/CHANGES.rst
===
--- Zope/branches/2.13/doc/CHANGES.rst  2013-01-11 12:53:01 UTC (rev 129035)
+++ Zope/branches/wichert-ofs-paste-naming/doc/CHANGES.rst  2013-01-11 
12:55:37 UTC (rev 129036)
@@ -8,6 +8,9 @@
 2.13.20 (unreleased)
 
 
+- OFS: Modify CopyContainer to pass the object to _get_id as well,
+  allowing for more flexible id generation logic such as using INameChooser.
+
 - In PageTemplate.pt_errors accept the check_macro_expansion argument.
   This is added for compatibility with zope.pagetemplate 4.0.0.  The
   argument is ignored.  See LP #732972.
@@ -16,6 +19,7 @@
 
   - Products.ZCTextIndex = 2.13.4
 
+
 2.13.19 (2012-10-31)
 
 

Modified: Zope/branches/wichert-ofs-paste-naming/src/OFS/CopySupport.py
===
--- Zope/branches/2.13/src/OFS/CopySupport.py   2013-01-11 12:53:01 UTC (rev 
129035)
+++ Zope/branches/wichert-ofs-paste-naming/src/OFS/CopySupport.py   
2013-01-11 12:55:37 UTC (rev 129036)
@@ -151,7 +151,7 @@
 return self.manage_main(self, REQUEST)
 return cp
 
-def _get_id(self, id):
+def _get_id(self, id, obj=None):
 # Allow containers to override the generation of
 # object copy id by attempting to call its _get_id
 # method, if it exists.
@@ -224,7 +224,11 @@
 message=sys.exc_info()[1],
 action='manage_main'))
 
-id = self._get_id(orig_id)
+try:
+id = self._get_id(orig_id, ob)
+except TypeError:
+# BBB for classes which do not have the second parameter.
+id = self._get_id(orig_id)
 result.append({'id': orig_id, 'new_id': id})
 
 orig_ob = ob
@@ -271,7 +275,11 @@
 if aq_base(orig_container) is aq_base(self):
 id = orig_id
 else:
-id = self._get_id(orig_id)
+try:
+id = self._get_id(orig_id, ob)
+except TypeError:
+# BBB for classes which do not have the second 
parameter.
+id = self._get_id(orig_id)
 result.append({'id': orig_id, 'new_id': id})
 
 notify(ObjectWillBeMovedEvent(ob, orig_container, orig_id,

Modified: 
Zope/branches/wichert-ofs-paste-naming/src/OFS/tests/testCopySupport.py
===
--- Zope/branches/2.13/src/OFS/tests/testCopySupport.py 2013-01-11 12:53:01 UTC 
(rev 129035)
+++ Zope/branches/wichert-ofs-paste-naming/src/OFS/tests/testCopySupport.py 
2013-01-11 12:55:37 UTC (rev 129036)
@@ -170,6 +170,22 @@
 self.assertTrue('newfile' in self.folder1.objectIds())
 self.assertTrue('newfile' in self.folder2.objectIds())
 
+def testPasteOld_get_idWithoutObjParameter( self ):
+from OFS.CopySupport import CopyContainer
+self.assertTrue( 'file' in self.folder1.objectIds() )
+self.assertFalse( 'file' in self.folder2.objectIds() )
+
+old_get_id = CopyContainer._get_id
+try:
+CopyContainer._get_id = lambda self, id: 'copy'
+cookie = self.folder1.manage_copyObjects( ids=('file',) )
+result = self.folder2.manage_pasteObjects( cookie )
+self.assertTrue( 'file' in self.folder1.objectIds() )
+self.assertTrue( 'copy' in self.folder2.objectIds() )
+self.assertTrue( result == [{'id':'file', 'new_id':'copy'}])
+finally:
+CopyContainer._get_id = old_get_id
+
 def testPasteSingleNotSameID( self ):
 self.assertTrue( 'file' in self.folder1.objectIds() )
 self.assertFalse( 'file' in self.folder2.objectIds() )

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


Re: [Zope-Checkins] [Checkins] SVN: Zope/trunk/ Removed the rarely used support for the `++skin++` traverser and added instructions on how to get it back for a specific application

2011-07-02 Thread Wichert Akkerman
On 07/02/2011 05:49 PM, Hanno Schlichting wrote:
 Log message for revision 122056:
Removed the rarely used support for the `++skin++` traverser and added 
 instructions on how to get it back for a specific application

FWIW I have multiple sites in production which rely heavily on ++skin++.

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


Re: [Zope-Checkins] [Checkins] SVN: Zope/trunk/ Removed catalog length migration code. Direct upgrades from Zope 2.7 and earlier are no longer supported.

2010-08-01 Thread Wichert Akkerman
On 8/1/10 14:52 , Hanno Schlichting wrote:
 Log message for revision 115322:
Removed catalog length migration code. Direct upgrades from Zope 2.7 and 
 earlier are no longer supported.


 Changed:
U   Zope/trunk/doc/CHANGES.rst
U   Zope/trunk/src/HelpSys/HelpTopic.py
U   Zope/trunk/src/Products/ZCatalog/Catalog.py
U   Zope/trunk/src/Products/ZCatalog/ZCatalog.py

 -=-
 Modified: Zope/trunk/doc/CHANGES.rst
 ===
 --- Zope/trunk/doc/CHANGES.rst2010-08-01 12:37:42 UTC (rev 115321)
 +++ Zope/trunk/doc/CHANGES.rst2010-08-01 12:52:08 UTC (rev 115322)
 @@ -35,6 +35,10 @@
   Restructuring
   +

 +- Removed catalog length migration code. You can no longer directly upgrade a
 +  Zope 2.7 or earlier database to Zope 2.13. Please upgrade to an earlier
 +  release first.

Shouldn't that be 2.8 and earlier? This bit suggests that:


 -def migrate__len__(self):
 - migration of old __len__ magic for Zope 2.8 
 -if not hasattr(self, '_length'):
 -n = self.__dict__['__len__']()
 -del self.__dict__['__len__']
 -self._length = BTrees.Length.Length(n)
 -

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


[Zope-Checkins] SVN: Zope/branches/2.12/ Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.

2010-05-28 Thread Wichert Akkerman
Log message for revision 112803:
  Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/Products/Five/testbrowser.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-05-28 15:31:11 UTC (rev 112802)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-05-28 15:42:05 UTC (rev 112803)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++
 
+- Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.
+
 - Five's processInputs() would stomp on :list or :tuple values that contained
   ints or other non-strings, would clear out :records entirely, and would not
   do anything for :record fields.

Modified: Zope/branches/2.12/src/Products/Five/testbrowser.py
===
--- Zope/branches/2.12/src/Products/Five/testbrowser.py 2010-05-28 15:31:11 UTC 
(rev 112802)
+++ Zope/branches/2.12/src/Products/Five/testbrowser.py 2010-05-28 15:42:05 UTC 
(rev 112803)
@@ -95,15 +95,10 @@
 '_equiv', '_basicauth', '_digestauth' ]
 
 def __init__(self, *args, **kws):
-inherited_handlers = ['_unknown', '_http_error',
-'_http_request_upgrade', '_http_default_error', '_basicauth',
-'_digestauth', '_redirect', '_cookies', '_referer',
-'_refresh', '_equiv', '_gzip']
-
-self.handler_classes = {http: PublisherHTTPHandler}
-for name in inherited_handlers:
-self.handler_classes[name] = 
mechanize.Browser.handler_classes[name]
-
+self.handler_classes = mechanize.Browser.handler_classes.copy()
+self.handler_classes[http] = PublisherHTTPHandler
+self.default_others = [cls for cls in self.default_others 
+   if cls in mechanize.Browser.handler_classes]
 mechanize.Browser.__init__(self, *args, **kws)
 
 

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


[Zope-Checkins] SVN: Zope/trunk/src/Testing/testbrowser.py Merge r112803 from 2.12 branch

2010-05-28 Thread Wichert Akkerman
Log message for revision 112804:
  Merge r112803 from 2.12 branch

Changed:
  U   Zope/trunk/src/Testing/testbrowser.py

-=-
Modified: Zope/trunk/src/Testing/testbrowser.py
===
--- Zope/trunk/src/Testing/testbrowser.py   2010-05-28 15:42:05 UTC (rev 
112803)
+++ Zope/trunk/src/Testing/testbrowser.py   2010-05-28 15:45:30 UTC (rev 
112804)
@@ -93,15 +93,10 @@
 '_equiv', '_basicauth', '_digestauth' ]
 
 def __init__(self, *args, **kws):
-inherited_handlers = ['_unknown', '_http_error',
-'_http_request_upgrade', '_http_default_error', '_basicauth',
-'_digestauth', '_redirect', '_cookies', '_referer',
-'_refresh', '_equiv', '_gzip']
-
-self.handler_classes = {http: PublisherHTTPHandler}
-for name in inherited_handlers:
-self.handler_classes[name] = 
mechanize.Browser.handler_classes[name]
-
+self.handler_classes = mechanize.Browser.handler_classes.copy()
+self.handler_classes[http] = PublisherHTTPHandler
+self.default_others = [cls for cls in self.default_others 
+   if cls in mechanize.Browser.handler_classes]
 mechanize.Browser.__init__(self, *args, **kws)
 
 

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


[Zope-Checkins] SVN: Zope/branches/2.12/doc/CHANGES.rst This is a feature really, not a bug

2010-05-28 Thread Wichert Akkerman
Log message for revision 112805:
  This is a feature really, not a bug

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

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-05-28 15:45:30 UTC (rev 112804)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-05-28 15:46:27 UTC (rev 112805)
@@ -11,8 +11,6 @@
 Bugs Fixed
 ++
 
-- Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.
-
 - Five's processInputs() would stomp on :list or :tuple values that contained
   ints or other non-strings, would clear out :records entirely, and would not
   do anything for :record fields.
@@ -49,6 +47,8 @@
 Features Added
 ++
 
+- Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.
+
 - LP #142226: Added an extra keyword argument to the HTTPResponse
   setCookie method to suppress enclosing the cookie value field
   in double quotes.

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


[Zope-Checkins] SVN: Zope/branches/2.12/ Fix several template errors in SiteErrorLog (chameleon compatibility)

2010-05-15 Thread Wichert Akkerman
Log message for revision 112324:
  Fix several template errors in SiteErrorLog (chameleon compatibility)

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/Products/SiteErrorLog/www/main.pt

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-05-15 06:47:53 UTC (rev 112323)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-05-15 06:51:46 UTC (rev 112324)
@@ -44,6 +44,8 @@
 Bugs Fixed
 ++
 
+- Fix several template errors in SiteErrorLog (chameleon compatibility).
+
 - LP #267820:  Fix bad except clause in the ``sequence_sort`` method of
   the ``dtml-in`` tag.
 

Modified: Zope/branches/2.12/src/Products/SiteErrorLog/www/main.pt
===
--- Zope/branches/2.12/src/Products/SiteErrorLog/www/main.pt2010-05-15 
06:47:53 UTC (rev 112323)
+++ Zope/branches/2.12/src/Products/SiteErrorLog/www/main.pt2010-05-15 
06:51:46 UTC (rev 112324)
@@ -85,7 +85,7 @@
 
 span tal:content=entry/typeAttributeError/span:
 span tal:define=value entry/value
-  tal:content=python: len(value)  70 and value or value[:70] + '...'
+  tal:content=python: len(value) lt; 70 and value or value[:70] + '...'
   Application object has no attribute zzope/span
/a
   /td
@@ -93,7 +93,7 @@
  tal:attributes=href 
string:${context/absolute_url}/forgetEntry?id=${entry/id}
   img title=Forget this entry src=/misc_/SiteErrorLog/ok.gif border=0
  tal:attributes=src string:${request/BASEPATH1}/misc_/SiteErrorLog/ok.gif
-  /a/td
+  //a/td
  /tr
 /table
 

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/SiteErrorLog/www/main.pt Merge r112324 from 2.12 branch

2010-05-15 Thread Wichert Akkerman
Log message for revision 112326:
  Merge r112324 from 2.12 branch

Changed:
  U   Zope/trunk/src/Products/SiteErrorLog/www/main.pt

-=-
Modified: Zope/trunk/src/Products/SiteErrorLog/www/main.pt
===
--- Zope/trunk/src/Products/SiteErrorLog/www/main.pt2010-05-15 06:54:16 UTC 
(rev 112325)
+++ Zope/trunk/src/Products/SiteErrorLog/www/main.pt2010-05-15 09:38:27 UTC 
(rev 112326)
@@ -85,7 +85,7 @@
 
 span tal:content=entry/typeAttributeError/span:
 span tal:define=value entry/value
-  tal:content=python: len(value)  70 and value or value[:70] + '...'
+  tal:content=python: len(value) lt; 70 and value or value[:70] + '...'
   Application object has no attribute zzope/span
/a
   /td
@@ -93,7 +93,7 @@
  tal:attributes=href 
string:${context/absolute_url}/forgetEntry?id=${entry/id}
   img title=Forget this entry src=/misc_/SiteErrorLog/ok.gif border=0
  tal:attributes=src string:${request/BASEPATH1}/misc_/SiteErrorLog/ok.gif
-  /a/td
+  //a/td
  /tr
 /table
 

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


[Zope-Checkins] SVN: Zope/trunk/src/Products/PluginIndexes/PathIndex/PathIndex.py Merge r110877 to trunk

2010-04-14 Thread Wichert Akkerman
Log message for revision 110879:
  Merge r110877 to trunk

Changed:
  U   Zope/trunk/src/Products/PluginIndexes/PathIndex/PathIndex.py

-=-
Modified: Zope/trunk/src/Products/PluginIndexes/PathIndex/PathIndex.py
===
--- Zope/trunk/src/Products/PluginIndexes/PathIndex/PathIndex.py
2010-04-14 12:50:03 UTC (rev 110878)
+++ Zope/trunk/src/Products/PluginIndexes/PathIndex/PathIndex.py
2010-04-14 12:51:12 UTC (rev 110879)
@@ -118,7 +118,7 @@
 self._length.change(1)
 
 for i in range(len(comps)):
-self._insertEntry(comps[i], docid, i)
+self.insertEntry(comps[i], docid, i)
 self._unindex[docid] = path
 return 1
 
@@ -228,7 +228,7 @@
 
 # Helper methods
 
-def _insertEntry(self, comp, id, level):
+def insertEntry(self, comp, id, level):
  Insert an entry.
 
 'comp' is an individual path component

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


[Zope-Checkins] SVN: Zope/branches/2.12/ Wrap exception views in the context of the published object.

2010-04-13 Thread Wichert Akkerman
Log message for revision 110779:
  Wrap exception views in the context of the published object.

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

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2010-04-13 12:12:24 UTC (rev 110778)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-04-13 12:13:26 UTC (rev 110779)
@@ -16,6 +16,7 @@
 - LP #142478:  normalize terms passed to ``PLexicon.queryLexicon`` using
   the lexicon's pipeline (e.g., case flattening, stop word removal, etc.)
 
+- Wrap exception views in the context of the published object.
 
 2.12.4 (2010-04-05)
 ---

Modified: Zope/branches/2.12/src/Zope2/App/startup.py
===
--- Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-13 12:12:24 UTC (rev 
110778)
+++ Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-13 12:13:26 UTC (rev 
110779)
@@ -20,6 +20,7 @@
 from Acquisition import aq_base
 from Acquisition import aq_inner
 from Acquisition import aq_parent
+from Acquisition.interfaces import IAcquirer
 from App.config import getConfiguration
 from time import asctime
 from types import StringType, ListType
@@ -208,6 +209,8 @@
 # Zope 3 uses as well.
 view = queryMultiAdapter((v, REQUEST), name=u'index.html')
 if view is not None:
+if IAcquirer.providedBy(published):
+view = view.__of__(published)
 v = view()
 response = REQUEST.RESPONSE
 response.setStatus(t)

Modified: Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py
===
--- Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py 2010-04-13 
12:12:24 UTC (rev 110778)
+++ Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py 2010-04-13 
12:13:26 UTC (rev 110779)
@@ -16,6 +16,7 @@
 import unittest
 import logging
 
+import Acquisition
 from zope.component.testing import PlacelessSetup
 from zope.interface.common.interfaces import IException
 from zope.publisher.skinnable import setDefaultSkin
@@ -215,7 +216,7 @@
 self.call_no_exc(hook, None, None, f)
 self.assertEquals(hook.unresolved_conflict_errors, 2)
 
-class Client:
+class Client(Acquisition.Explicit):
 
 def __init__(self):
 self.standard_error_message = True
@@ -320,14 +321,16 @@
 tb = client.messages[0]
 self.failUnless(ConflictError: database conflict error in tb, tb)
 
-class CustomExceptionView:
+class CustomExceptionView(Acquisition.Explicit):
 
 def __init__(self, context, request):
 self.context = context
 self.request = request
 
 def __call__(self):
-return Exception View: %s % self.context.__class__.__name__
+return Exception View: %s\nContext: %s % (
+self.context.__class__.__name__,
+Acquisition.aq_parent(self).__class__.__name__)
 
 def registerExceptionView(for_):
 from zope.interface import Interface
@@ -355,6 +358,7 @@
 self.failUnless(isinstance(v, HTTPResponse), v)
 self.failUnless(v.status == 401, (v.status, 401))
 self.failUnless(Exception View: Unauthorized in str(v))
+self.failUnless(Context: StandardClient in str(v))
 
 def testCustomExceptionViewForbidden(self):
 from ZPublisher.HTTPResponse import HTTPResponse

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


[Zope-Checkins] SVN: Zope/trunk/src/Zope2/App/ Merge change from 2.12 branch

2010-04-13 Thread Wichert Akkerman
Log message for revision 110780:
  Merge change from 2.12 branch

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

-=-
Modified: Zope/trunk/src/Zope2/App/startup.py
===
--- Zope/trunk/src/Zope2/App/startup.py 2010-04-13 12:13:26 UTC (rev 110779)
+++ Zope/trunk/src/Zope2/App/startup.py 2010-04-13 12:16:42 UTC (rev 110780)
@@ -24,6 +24,7 @@
 from Acquisition import aq_base
 from Acquisition import aq_inner
 from Acquisition import aq_parent
+from Acquisition.interfaces import IAcquirer
 from App.config import getConfiguration
 from time import asctime
 from zExceptions import upgradeException
@@ -218,6 +219,8 @@
 # zope.publisher uses as well.
 view = queryMultiAdapter((v, REQUEST), name=u'index.html')
 if view is not None:
+if IAcquirer.providedBy(published):
+view = view.__of__(published)
 v = view()
 response = REQUEST.RESPONSE
 response.setStatus(t)

Modified: Zope/trunk/src/Zope2/App/tests/testExceptionHook.py
===
--- Zope/trunk/src/Zope2/App/tests/testExceptionHook.py 2010-04-13 12:13:26 UTC 
(rev 110779)
+++ Zope/trunk/src/Zope2/App/tests/testExceptionHook.py 2010-04-13 12:16:42 UTC 
(rev 110780)
@@ -16,6 +16,7 @@
 import unittest
 import logging
 
+import Acquisition
 from zope.component.testing import PlacelessSetup
 from zope.interface.common.interfaces import IException
 from zope.publisher.skinnable import setDefaultSkin
@@ -215,7 +216,7 @@
 self.call_no_exc(hook, None, None, f)
 self.assertEquals(hook.unresolved_conflict_errors, 2)
 
-class Client:
+class Client(Acquisition.Explicit):
 
 def __init__(self):
 self.standard_error_message = True
@@ -320,14 +321,16 @@
 tb = client.messages[0]
 self.failUnless(ConflictError: database conflict error in tb, tb)
 
-class CustomExceptionView:
+class CustomExceptionView(Acquisition.Explicit):
 
 def __init__(self, context, request):
 self.context = context
 self.request = request
 
 def __call__(self):
-return Exception View: %s % self.context.__class__.__name__
+return Exception View: %s\nContext: %s % (
+self.context.__class__.__name__,
+Acquisition.aq_parent(self).__class__.__name__)
 
 def registerExceptionView(for_):
 from zope.interface import Interface
@@ -355,6 +358,7 @@
 self.failUnless(isinstance(v, HTTPResponse), v)
 self.failUnless(v.status == 401, (v.status, 401))
 self.failUnless(Exception View: Unauthorized in str(v))
+self.failUnless(Context: StandardClient in str(v))
 
 def testCustomExceptionViewForbidden(self):
 from ZPublisher.HTTPResponse import HTTPResponse

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/Zope2/App/startup.py Safety harness

2010-04-13 Thread Wichert Akkerman
Log message for revision 110784:
  Safety harness

Changed:
  U   Zope/branches/2.12/src/Zope2/App/startup.py

-=-
Modified: Zope/branches/2.12/src/Zope2/App/startup.py
===
--- Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-13 12:32:23 UTC (rev 
110783)
+++ Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-13 12:36:47 UTC (rev 
110784)
@@ -209,7 +209,7 @@
 # Zope 3 uses as well.
 view = queryMultiAdapter((v, REQUEST), name=u'index.html')
 if view is not None:
-if IAcquirer.providedBy(published):
+if IAcquirer.providedBy(view) and 
IAcquirer.providedBy(published):
 view = view.__of__(published)
 v = view()
 response = REQUEST.RESPONSE

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


[Zope-Checkins] SVN: Zope/branches/2.12/src/Zope2/App/startup.py Acquisition is an even harsher mistress now that we have __parent__

2010-04-13 Thread Wichert Akkerman
Log message for revision 110785:
  Acquisition is an even harsher mistress now that we have __parent__

Changed:
  U   Zope/branches/2.12/src/Zope2/App/startup.py

-=-
Modified: Zope/branches/2.12/src/Zope2/App/startup.py
===
--- Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-13 12:36:47 UTC (rev 
110784)
+++ Zope/branches/2.12/src/Zope2/App/startup.py 2010-04-13 12:43:06 UTC (rev 
110785)
@@ -211,6 +211,8 @@
 if view is not None:
 if IAcquirer.providedBy(view) and 
IAcquirer.providedBy(published):
 view = view.__of__(published)
+else:
+view.__parent__ = published
 v = view()
 response = REQUEST.RESPONSE
 response.setStatus(t)

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


[Zope-Checkins] SVN: Zope/trunk/src/Zope2/App/startup.py Merge changes from 2.12 branch

2010-04-13 Thread Wichert Akkerman
Log message for revision 110786:
  Merge changes from 2.12 branch

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

-=-
Modified: Zope/trunk/src/Zope2/App/startup.py
===
--- Zope/trunk/src/Zope2/App/startup.py 2010-04-13 12:43:06 UTC (rev 110785)
+++ Zope/trunk/src/Zope2/App/startup.py 2010-04-13 12:44:02 UTC (rev 110786)
@@ -219,8 +219,10 @@
 # zope.publisher uses as well.
 view = queryMultiAdapter((v, REQUEST), name=u'index.html')
 if view is not None:
-if IAcquirer.providedBy(published):
+if IAcquirer.providedBy(view) and 
IAcquirer.providedBy(published):
 view = view.__of__(published)
+else:
+view.__parent__ = published
 v = view()
 response = REQUEST.RESPONSE
 response.setStatus(t)

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


[Zope-Checkins] SVN: Zope/branches/wichert=request-modifier/ New branch to test a ZPublisher change

2010-02-21 Thread Wichert Akkerman
Log message for revision 109225:
  New branch to test a ZPublisher change
  

Changed:
  A   Zope/branches/wichert=request-modifier/

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


[Zope-Checkins] SVN: Zope/branches/wichert=request-modifier/ If a traversal step returns the same object do not call before-publish hooks again

2010-02-21 Thread Wichert Akkerman
Log message for revision 109226:
  If a traversal step returns the same object do not call before-publish hooks 
again
  

Changed:
  U   Zope/branches/wichert=request-modifier/doc/CHANGES.rst
  U   Zope/branches/wichert=request-modifier/src/ZPublisher/BaseRequest.py
  U   
Zope/branches/wichert=request-modifier/src/ZPublisher/tests/testBeforeTraverse.py

-=-
Modified: Zope/branches/wichert=request-modifier/doc/CHANGES.rst
===
--- Zope/branches/wichert=request-modifier/doc/CHANGES.rst  2010-02-21 
20:44:15 UTC (rev 109225)
+++ Zope/branches/wichert=request-modifier/doc/CHANGES.rst  2010-02-21 
21:12:32 UTC (rev 109226)
@@ -20,6 +20,9 @@
 Bugs Fixed
 ++
 
+- If a traversal step returns the same object do not call before-publish hooks
+  again.
+
 - Protect ZCTextIndex's clear method against storing Acquisition wrappers.
 
 - LP #195761: fixed ZMI XML export / import and restored it to the UI.

Modified: Zope/branches/wichert=request-modifier/src/ZPublisher/BaseRequest.py
===
--- Zope/branches/wichert=request-modifier/src/ZPublisher/BaseRequest.py
2010-02-21 20:44:15 UTC (rev 109225)
+++ Zope/branches/wichert=request-modifier/src/ZPublisher/BaseRequest.py
2010-02-21 21:12:32 UTC (rev 109226)
@@ -36,6 +36,12 @@
 # quote url path segments, but leave + and @ intact
 return urllib_quote(text, '/+@')
 
+def _base(obj):
+if IAcquirer.providedBy(obj):
+return aq_base(obj)
+return obj
+
+
 try:
 from ExtensionClass import Base
 from ZPublisher.Converters import type_converters
@@ -428,10 +434,12 @@
 try:
 # We build parents in the wrong order, so we
 # need to make sure we reverse it when we're done.
+same_object = False
 while 1:
-bpth = getattr(object, '__before_publishing_traverse__', None)
-if bpth is not None:
-bpth(object, self)
+if not same_object:
+bpth = getattr(object, '__before_publishing_traverse__', 
None)
+if bpth is not None:
+bpth(object, self)
 
 path = request.path = request['TraversalRequestNameStack']
 # Check for method:
@@ -505,6 +513,7 @@
 self.roles = getRoles(
 object, check_name, subobject,
 self.roles)
+same_object =  _base(object) is _base(subobject)
 object = subobject
 except (KeyError, AttributeError):
 if response.debug_mode:

Modified: 
Zope/branches/wichert=request-modifier/src/ZPublisher/tests/testBeforeTraverse.py
===
--- 
Zope/branches/wichert=request-modifier/src/ZPublisher/tests/testBeforeTraverse.py
   2010-02-21 20:44:15 UTC (rev 109225)
+++ 
Zope/branches/wichert=request-modifier/src/ZPublisher/tests/testBeforeTraverse.py
   2010-02-21 21:12:32 UTC (rev 109226)
@@ -1,10 +1,12 @@
 import sys
 import logging
 
+from zope.interface import implements
 from Acquisition import Implicit
 from ZPublisher import BeforeTraverse
 from ZPublisher.BaseRequest import BaseRequest
 from ZPublisher.HTTPResponse import HTTPResponse
+from zope.publisher.interfaces import IPublishTraverse
 
 def makeBaseRequest(root):
 response = HTTPResponse()
@@ -133,6 +135,39 @@
 
 pass
 
+class CountHook:
+counter = 0
+def __call__(self, obj, request):
+self.counter += 1
+
+
+class TraverseToSelfObject(Implicit):
+implements(IPublishTraverse)
+def publishTraverse(self, request, name):
+return self
+
+def testNoMulitpleCalls(self):
+
+Sometimes a traversal adapter is used which only modifies the
+request, but does not do any real traversing. Skin traversal
+adapters are a common example of this type of adapter. In this
+case we do not want to call the before publish hooks for the
+same object multiple times.
+
+ root = DummyObjectBasic()
+ request = makeBaseRequest(root)
+
+ container = TraverseToSelfObject()
+ root.container = container
+
+ counter = CountHook()
+ BeforeTraverse.registerBeforeTraverse(container, counter, 'count_hook')
+
+ _ = request.traverse('container/traverser/obj')
+ counter.counter
+1
+
+
 from zope.testing import doctest
 
 def test_suite():

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


Re: [Zope-Checkins] [Checkins] SVN: Zope/branches/2.12/ Fall back to HELO when EHLO (an optional extension) fails

2010-02-03 Thread Wichert Akkerman
On 2/3/10 15:07 , Martijn Pieters wrote:
 Log message for revision 108731:
Fall back to HELO when EHLO (an optional extension) fails

Does that check if the server greets you with ESMTP or SMTP? If it is 
ESMTP and EHLO fails something is quite wrong, and if it is SMTP you 
already know EHLO will fail.

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


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Products/PageTemplates/tests/ Add a TAL attribute test

2008-03-09 Thread Wichert Akkerman
Log message for revision 70918:
  Add a TAL attribute test

Changed:
  A   
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/input/Attributes.html
  A   
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/output/Attributes.html
  U   Zope/branches/2.9/lib/python/Products/PageTemplates/tests/testHTMLTests.py

-=-
Added: 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/input/Attributes.html
===
--- 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/input/Attributes.html 
2006-10-26 03:31:32 UTC (rev 70917)
+++ 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/input/Attributes.html 
2006-10-26 15:36:20 UTC (rev 70918)
@@ -0,0 +1,7 @@
+html
+head/head
+body
+p tal:attributes=disabled python:True and default or 'disabled'/p
+p tal:attributes=disabled python:False and default or 'disabled'/p
+/body
+/html

Added: 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/output/Attributes.html
===
--- 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/output/Attributes.html
2006-10-26 03:31:32 UTC (rev 70917)
+++ 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/output/Attributes.html
2006-10-26 15:36:20 UTC (rev 70918)
@@ -0,0 +1,7 @@
+html
+head/head
+body
+p/p
+p disabled=disabled/p
+/body
+/html

Modified: 
Zope/branches/2.9/lib/python/Products/PageTemplates/tests/testHTMLTests.py
===
--- Zope/branches/2.9/lib/python/Products/PageTemplates/tests/testHTMLTests.py  
2006-10-26 03:31:32 UTC (rev 70917)
+++ Zope/branches/2.9/lib/python/Products/PageTemplates/tests/testHTMLTests.py  
2006-10-26 15:36:20 UTC (rev 70918)
@@ -156,6 +156,9 @@
 self.assert_expected(self.folder.t, 'CheckI18nTranslateHooked.html')
 setGlobalTranslationService(old_ts)
 
+def checkAttributes(self):
+self.assert_expected(self.folder.t, 'Attributes.html')
+
 def test_suite():
 return unittest.makeSuite(HTMLTests, 'check')
 

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/ImageFile.py Remove useless executable flag

2008-03-09 Thread Wichert Akkerman
Log message for revision 72900:
  Remove useless executable flag

Changed:
  _U  Zope/branches/2.10/lib/python/ImageFile.py

-=-

Property changes on: Zope/branches/2.10/lib/python/ImageFile.py
___
Name: svn:executable
   - *

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


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/ Set and restore the site for functional tests as well

2008-03-09 Thread Wichert Akkerman
Log message for revision 73047:
  Set and restore the site for functional tests as well

Changed:
  U   Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py
  U   
Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py

-=-
Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py
===
--- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py
2007-03-08 00:58:14 UTC (rev 73046)
+++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py
2007-03-08 01:23:02 UTC (rev 73047)
@@ -37,6 +37,7 @@
 request_method='GET', stdin=None, handle_errors=True):
 '''Publishes the object at 'path' returning a response object.'''
 
+from zope.app.component.hooks import setSite, getSite
 from StringIO import StringIO
 from ZPublisher.Response import Response
 from ZPublisher.Test import publish_module
@@ -47,6 +48,10 @@
 # Save current security manager
 sm = getSecurityManager()
 
+# And we need to store the old site
+old_site = getSite()
+setSite(None)
+
 # Commit the sandbox for good measure
 transaction.commit()
 
@@ -89,6 +94,9 @@
 # Restore security manager
 setSecurityManager(sm)
 
+# And we need to restore the site again
+setSite(old_site)
+
 return ResponseWrapper(response, outstream, path)
 
 

Modified: 
Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===
--- 
Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
2007-03-08 00:58:14 UTC (rev 73046)
+++ 
Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
2007-03-08 01:23:02 UTC (rev 73047)
@@ -117,6 +117,7 @@
 
 import urllib
 import rfc822
+from zope.app.component.hooks import setSite, getSite
 from cStringIO import StringIO
 from ZPublisher.Response import Response
 from ZPublisher.Test import publish_module
@@ -126,6 +127,10 @@
 # Save current Security Manager
 old_sm = getSecurityManager()
 
+# And we need to store the old site
+old_site = getSite()
+setSite(None)
+
 # Commit work done by previous python code.
 transaction.commit()
 
@@ -193,7 +198,10 @@
 # by calling the publish method above
 setSecurityManager(old_sm)
 
+# And we need to restore the site again
+setSite(old_site)
 # Sync connection
+
 sync()
 
 return DocResponseWrapper(response, outstream, path, header_output)

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ Set and restore the site for functional tests as well. Forward port from 2.10 branch

2008-03-09 Thread Wichert Akkerman
Log message for revision 73048:
  Set and restore the site for functional tests as well. Forward port from 2.10 
branch

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

-=-
Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py
===
--- Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py2007-03-08 
01:23:02 UTC (rev 73047)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py2007-03-08 
01:23:55 UTC (rev 73048)
@@ -39,6 +39,7 @@
 request_method='GET', stdin=None, handle_errors=True):
 '''Publishes the object at 'path' returning a response object.'''
 
+from zope.app.component.hooks import setSite, getSite
 from StringIO import StringIO
 from ZPublisher.Response import Response
 from ZPublisher.Test import publish_module
@@ -49,6 +50,10 @@
 # Save current security manager
 sm = getSecurityManager()
 
+# And we need to store the old site
+old_site = getSite()
+setSite(None)
+
 # Commit the sandbox for good measure
 transaction.commit()
 
@@ -91,6 +96,9 @@
 # Restore security manager
 setSecurityManager(sm)
 
+# And we need to restore the site again
+setSite(old_site)
+
 return ResponseWrapper(response, outstream, path)
 
 

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===
--- Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
2007-03-08 01:23:02 UTC (rev 73047)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
2007-03-08 01:23:55 UTC (rev 73048)
@@ -117,6 +117,7 @@
 
 import urllib
 import rfc822
+from zope.app.component.hooks import setSite, getSite
 from cStringIO import StringIO
 from ZPublisher.Response import Response
 from ZPublisher.Test import publish_module
@@ -126,6 +127,10 @@
 # Save current Security Manager
 old_sm = getSecurityManager()
 
+# And we need to store the old site
+old_site = getSite()
+setSite(None)
+
 # Commit work done by previous python code.
 transaction.commit()
 
@@ -193,7 +198,10 @@
 # by calling the publish method above
 setSecurityManager(old_sm)
 
+# And we need to restore the site again
+setSite(old_site)
 # Sync connection
+
 sync()
 
 return DocResponseWrapper(response, outstream, path, header_output)

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/ Delay registration of python packages until a moment when a ZODB connection is available http://www.zope.org/Collectors/Zope/2293

2008-03-09 Thread Wichert Akkerman
Log message for revision 76740:
  Delay registration of python packages until a moment when a ZODB connection 
is available http://www.zope.org/Collectors/Zope/2293

Changed:
  U   Zope/trunk/lib/python/OFS/Application.py
  U   Zope/trunk/lib/python/OFS/ObjectManager.py
  U   Zope/trunk/lib/python/OFS/tests/testObjectManager.py
  U   Zope/trunk/lib/python/Products/Five/fiveconfigure.py
  U   Zope/trunk/lib/python/Products/Five/tests/test_registerpackage.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeLite.py

-=-
Modified: Zope/trunk/lib/python/OFS/Application.py
===
--- Zope/trunk/lib/python/OFS/Application.py2007-06-17 18:10:22 UTC (rev 
76739)
+++ Zope/trunk/lib/python/OFS/Application.py2007-06-17 18:16:23 UTC (rev 
76740)
@@ -633,6 +633,24 @@
 install_product(app, product_dir, product_name, meta_types,
 folder_permissions, raise_exc=debug_mode)
 
+# Delayed install of products-as-packages
+for module_, init_func in getattr(Products, '_packages_to_initialize', []):
+try:
+product = App.Product.initializeProduct(module_, 
+module_.__name__, 
+module_.__path__[0],
+app)
+
+product.package_name = module_.__name__
+
+if init_func is not None:
+newContext = ProductContext(product, app, module_)
+init_func(newContext)
+finally:
+transaction.commit()
+if hasattr(Products, '_packages_to_initialize'):
+del Products._packages_to_initialize
+
 Products.meta_types=Products.meta_types+tuple(meta_types)
 InitializeClass(Folder.Folder)
 

Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===
--- Zope/trunk/lib/python/OFS/ObjectManager.py  2007-06-17 18:10:22 UTC (rev 
76739)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py  2007-06-17 18:16:23 UTC (rev 
76740)
@@ -705,6 +705,7 @@
 out=out+((k,stat),)
 return marshal.dumps(out)
 
+security.declareProtected(access_contents_information, 'manage_hasId')
 def manage_hasId(self, REQUEST):
  check if the folder has an object with REQUEST['id'] 
 

Modified: Zope/trunk/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/trunk/lib/python/OFS/tests/testObjectManager.py2007-06-17 
18:10:22 UTC (rev 76739)
+++ Zope/trunk/lib/python/OFS/tests/testObjectManager.py2007-06-17 
18:16:23 UTC (rev 76740)
@@ -411,6 +411,16 @@
 self.failUnless(filename.endswith('.zexp') or
 filename.endswith('.xml'))
 
+def test_hasId(self):
+om = self._makeOne()
+request={'id' : 'test'}
+self.assertRaises(KeyError, om.manage_hasId, request)
+
+si = SimpleItem('test')
+om._setObject('test', si)
+om.manage_hasId(request)
+
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest( unittest.makeSuite( ObjectManagerTests ) )

Modified: Zope/trunk/lib/python/Products/Five/fiveconfigure.py
===
--- Zope/trunk/lib/python/Products/Five/fiveconfigure.py2007-06-17 
18:10:22 UTC (rev 76739)
+++ Zope/trunk/lib/python/Products/Five/fiveconfigure.py2007-06-17 
18:16:23 UTC (rev 76740)
@@ -201,35 +201,25 @@
 def _registerPackage(module_, init_func=None):
 Registers the given python package as a Zope 2 style product
 
-
+
 if not hasattr(module_, '__path__'):
 raise ValueError(Must be a package and the  \
  package must be filesystem based)
 
-app = Zope2.app()
-try:
-product = initializeProduct(module_, 
-module_.__name__, 
-module_.__path__[0],
-app)
+registered_packages = getattr(Products, '_registered_packages', None)
+if registered_packages is None:
+registered_packages = Products._registered_packages = []
+registered_packages.append(module_)
+
+# Delay the actual setup until the usual product loading time in
+# OFS.Application. Otherwise, we may get database write errors in
+# ZEO, when there's no connection with which to write an entry to
+# Control_Panel. We would also get multiple calls to initialize().
+to_initialize = getattr(Products, '_packages_to_initialize', None)
+if to_initialize is None:
+to_initialize = Products._packages_to_initialize = []
+to_initialize.append((module_, init_func,))
 
-product.package_name = module_.__name__
-
-if init_func is not None:
-newContext = 

[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/ I hate unclean checkouts...

2008-03-09 Thread Wichert Akkerman
Log message for revision 76741:
  I hate unclean checkouts...

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

-=-
Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===
--- Zope/trunk/lib/python/OFS/ObjectManager.py  2007-06-17 18:16:23 UTC (rev 
76740)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py  2007-06-17 18:20:41 UTC (rev 
76741)
@@ -705,7 +705,6 @@
 out=out+((k,stat),)
 return marshal.dumps(out)
 
-security.declareProtected(access_contents_information, 'manage_hasId')
 def manage_hasId(self, REQUEST):
  check if the folder has an object with REQUEST['id'] 
 

Modified: Zope/trunk/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/trunk/lib/python/OFS/tests/testObjectManager.py2007-06-17 
18:16:23 UTC (rev 76740)
+++ Zope/trunk/lib/python/OFS/tests/testObjectManager.py2007-06-17 
18:20:41 UTC (rev 76741)
@@ -411,16 +411,6 @@
 self.failUnless(filename.endswith('.zexp') or
 filename.endswith('.xml'))
 
-def test_hasId(self):
-om = self._makeOne()
-request={'id' : 'test'}
-self.assertRaises(KeyError, om.manage_hasId, request)
-
-si = SimpleItem('test')
-om._setObject('test', si)
-om.manage_hasId(request)
-
-
 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: Products.Five/branches/1.5/ If Zope supports it delay initialization of packages until a later moment when a ZODB connection is available. This fixes http://www.zope.org/Collector

2008-03-09 Thread Wichert Akkerman
Log message for revision 76744:
  If Zope supports it delay initialization of packages until a later moment 
when a ZODB connection is available. This fixes 
http://www.zope.org/Collectors/Zope/2293

Changed:
  U   Products.Five/branches/1.5/fiveconfigure.py
  U   Products.Five/branches/1.5/tests/test_registerpackage.py

-=-
Modified: Products.Five/branches/1.5/fiveconfigure.py
===
--- Products.Five/branches/1.5/fiveconfigure.py 2007-06-17 19:04:57 UTC (rev 
76743)
+++ Products.Five/branches/1.5/fiveconfigure.py 2007-06-17 19:05:59 UTC (rev 
76744)
@@ -201,34 +201,47 @@
 def _registerPackage(module_, init_func=None):
 Registers the given python package as a Zope 2 style product
 
-
+
 if not hasattr(module_, '__path__'):
 raise ValueError(Must be a package and the  \
  package must be filesystem based)
 
-app = Zope2.app()
-try:
-product = initializeProduct(module_, 
-module_.__name__, 
-module_.__path__[0],
-app)
+registered_packages = getattr(Products, '_registered_packages', None)
+if registered_packages is None:
+registered_packages = Products._registered_packages = []
+registered_packages.append(module_)
+
+# Delay the actual setup until the usual product loading time in
+# OFS.Application on versions of Zope that support this. 
+# 
+# Without this processing, we may get database write errors in
+# ZEO, when there's no connection with which to write an entry to
+# Control_Panel. We would also get multiple calls to initialize().
+# 
+# For older versions of Zope not aware of this variable, initialize
+# immediately as before
+to_initialize = getattr(Products, '_packages_to_initialize', None)
+if to_initialize is None:
+app = Zope2.app()
+try:
+product = initializeProduct(module_, 
+module_.__name__, 
+module_.__path__[0],
+app)
 
-product.package_name = module_.__name__
+product.package_name = module_.__name__
 
-if init_func is not None:
-newContext = ProductContext(product, app, module_)
-init_func(newContext)
-
-registered_packages = getattr(Products, '_registered_packages', None)
-if registered_packages is None:
-registered_packages = Products._registered_packages = []
-registered_packages.append(module_)
-finally:
-try:
-import transaction
-transaction.commit()
+if init_func is not None:
+newContext = ProductContext(product, app, module_)
+init_func(newContext)
 finally:
-app._p_jar.close()
+try:
+import transaction
+transaction.commit()
+finally:
+app._p_jar.close()
+else:
+to_initialize.append((module_, init_func,))
 
 def registerPackage(_context, package, initialize=None):
 ZCML directive function for registering a python package product

Modified: Products.Five/branches/1.5/tests/test_registerpackage.py
===
--- Products.Five/branches/1.5/tests/test_registerpackage.py2007-06-17 
19:04:57 UTC (rev 76743)
+++ Products.Five/branches/1.5/tests/test_registerpackage.py2007-06-17 
19:05:59 UTC (rev 76744)
@@ -49,15 +49,28 @@
   ...   /
   ... /configure'''
zcml.load_string(configure_zcml)
+  
+We need to load the product as well. This would normally happen during 
+Zope startup, but in the test, we're already too late.
+
+   import Zope2
+   from OFS.Application import install_products
+  
+   app = Zope2.app()
+   install_products(app)
   pythonproduct2 initialized
-
   
+NOTE: In version 1.5.3 and earlier, the call to initialize() used to 
+happen during ZCML processing. That's bad, because it attempts to do
+a ZODB write before sufficient context is available, at least when using
+ZEO. If you run this test on Zope 2.10.3 or below, you may see doctest
+failures indicating that the product was loaded immediately after the
+call to zcml.load_string() above. That's the BBB code kicking in.
+  
 Test to see if the pythonproduct2 python package actually gets setup
 as a zope2 product in the Control Panel.
 
product_listing = []
-   import Zope2
-   app = Zope2.app()
try:
   ...product_listing = app.Control_Panel.Products.objectIds()
   ... finally:

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

[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/BaseRequest.py Fix typo

2008-03-09 Thread Wichert Akkerman
Log message for revision 76753:
  Fix typo

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

-=-
Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2007-06-18 08:33:03 UTC 
(rev 76752)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2007-06-18 08:50:15 UTC 
(rev 76753)
@@ -414,7 +414,7 @@
 entry_name = ''
 try:
 # We build parents in the wrong order, so we
-# need to make sure we reverse it when we're doe.
+# need to make sure we reverse it when we're done.
 while 1:
 bpth = getattr(object, '__before_publishing_traverse__', None)
 if bpth is not None:

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/App/FindHomes.py Base the default location of softwarehome on Zope2, which is guaranteed not to be a namespace but always located inside the Zope2 software h

2007-11-13 Thread Wichert Akkerman
Log message for revision 81815:
  Base the default location of softwarehome on Zope2, which is guaranteed not 
to be a namespace but always located inside the Zope2 software home. This fixes 
Zope2 breaking on systems which uses namespace packages for Products.*

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

-=-
Modified: Zope/trunk/lib/python/App/FindHomes.py
===
--- Zope/trunk/lib/python/App/FindHomes.py  2007-11-13 08:55:24 UTC (rev 
81814)
+++ Zope/trunk/lib/python/App/FindHomes.py  2007-11-13 09:17:28 UTC (rev 
81815)
@@ -26,7 +26,8 @@
 try:
 home = os.environ['SOFTWARE_HOME']
 except KeyError:
-home = os.path.abspath(package_home(Products.__dict__))
+import Zope2
+home = os.path.abspath(package_home(Zope2.__dict__))
 
 home, e = os.path.split(home)
 d, e = os.path.split(home)

___
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/FindHomes.py Base the default location of softwarehome on Zope2, which is guaranteed not to be a namespace but always located inside the Zope2 so

2007-11-13 Thread Wichert Akkerman
Log message for revision 81816:
  Base the default location of softwarehome on Zope2, which is guaranteed not 
to be a namespace but always located inside the Zope2 software home. This fixes 
Zope2 breaking on systems which uses namespace packages for Products.*

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

-=-
Modified: Zope/branches/2.10/lib/python/App/FindHomes.py
===
--- Zope/branches/2.10/lib/python/App/FindHomes.py  2007-11-13 09:17:28 UTC 
(rev 81815)
+++ Zope/branches/2.10/lib/python/App/FindHomes.py  2007-11-13 09:20:30 UTC 
(rev 81816)
@@ -26,7 +26,8 @@
 try:
 home = os.environ['SOFTWARE_HOME']
 except KeyError:
-home = os.path.abspath(package_home(Products.__dict__))
+import Zope2
+home = os.path.abspath(package_home(Zope2.__dict__))
 
 home, e = os.path.split(home)
 d, e = os.path.split(home)

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/App/dtml/profile.dtml Remove useless svn:executable flag

2007-10-02 Thread Wichert Akkerman
Log message for revision 80490:
  Remove useless svn:executable flag

Changed:
  _U  Zope/trunk/lib/python/App/dtml/profile.dtml

-=-

Property changes on: Zope/trunk/lib/python/App/dtml/profile.dtml
___
Name: svn:executable
   - *

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


[Zope-Checkins] SVN: Zope/branches/2.10/ Merge r80451 from trunk

2007-10-01 Thread Wichert Akkerman
Log message for revision 80452:
  Merge r80451 from trunk

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/Zope2/Startup/zopeschema.xml

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===
--- Zope/branches/2.10/doc/CHANGES.txt  2007-10-01 19:48:13 UTC (rev 80451)
+++ Zope/branches/2.10/doc/CHANGES.txt  2007-10-01 20:05:49 UTC (rev 80452)
@@ -8,6 +8,9 @@
 
 Bugs fixed
 
+  - Launchpad #147201: treat container-class in zope.conf as a string,
+making it possible to use types from extra products directories.
+
   - Collector #2358: backported fix making 'Products' package a real
 namespace package from the trunk.
 

Modified: Zope/branches/2.10/lib/python/Zope2/Startup/zopeschema.xml
===
--- Zope/branches/2.10/lib/python/Zope2/Startup/zopeschema.xml  2007-10-01 
19:48:13 UTC (rev 80451)
+++ Zope/branches/2.10/lib/python/Zope2/Startup/zopeschema.xml  2007-10-01 
20:05:49 UTC (rev 80452)
@@ -242,7 +242,7 @@
   /description
 /key
 
-key name=container-class datatype=.python_dotted_path
+key name=container-class datatype=string
   description
Change the contiainer class a (mounted) database uses on a
per-database basis to support a different container than a plain

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


[Zope-Checkins] SVN: Zope/branches/2.9/ Merge r80451 from trunk

2007-10-01 Thread Wichert Akkerman
Log message for revision 80453:
  Merge r80451 from trunk

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2007-10-01 20:05:49 UTC (rev 80452)
+++ Zope/branches/2.9/doc/CHANGES.txt   2007-10-01 20:12:35 UTC (rev 80453)
@@ -8,6 +8,9 @@
 
Bugs fixed
 
+  - Launchpad #147201: treat container-class in zope.conf as a string,
+making it possible to use types from extra products directories.
+
   - Collector #2287: form ':record' objects did not implement enough
 of the mapping protocol.
 

Modified: Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml
===
--- Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml   2007-10-01 
20:05:49 UTC (rev 80452)
+++ Zope/branches/2.9/lib/python/Zope2/Startup/zopeschema.xml   2007-10-01 
20:12:35 UTC (rev 80453)
@@ -236,7 +236,7 @@
   /description
 /key
 
-key name=container-class datatype=.python_dotted_path
+key name=container-class datatype=string
   description
Change the contiainer class a (mounted) database uses on a
per-database basis to support a different container than a plain

___
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/tests/testObjectManager.py Add simple tests for manage_hasId

2006-06-21 Thread Wichert Akkerman
Log message for revision 68648:
  Add simple tests for manage_hasId

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

-=-
Modified: Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py
===
--- Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py
2006-06-15 10:24:55 UTC (rev 68647)
+++ Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py
2006-06-15 11:22:56 UTC (rev 68648)
@@ -411,6 +411,16 @@
 self.failUnless(filename.endswith('.zexp') or
 filename.endswith('.xml'))
 
+def test_hasId(self):
+om = self._makeOne()
+request={'id' : 'test'}
+self.assertRaises(KeyError, om.manage_hasId, request)
+
+si = SimpleItem('test')
+om._setObject('test', si)
+om.manage_hasId(request)
+
+
 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