[Zope-Checkins] SVN: Products.Five/branches/1.4/CHANGES.txt Reorganized changelog entries to reflect bug fixes and restructuring for unreleased.

2006-07-20 Thread Rocky Burt
Log message for revision 69227:
  Reorganized changelog entries to reflect bug fixes and restructuring for 
unreleased.

Changed:
  U   Products.Five/branches/1.4/CHANGES.txt

-=-
Modified: Products.Five/branches/1.4/CHANGES.txt
===
--- Products.Five/branches/1.4/CHANGES.txt  2006-07-20 12:22:54 UTC (rev 
69226)
+++ Products.Five/branches/1.4/CHANGES.txt  2006-07-20 12:32:25 UTC (rev 
69227)
@@ -5,27 +5,30 @@
 Five 1.4.1 (unreleased)
 ===
 
+Bugfixes
+
+
+* Made the pythonproducts monkey patching more robust by checking to
+  ensure patches aren't reapplied and cleaning up after itself.
+
 * Backported the new traversal lookup order from Zope 2.10 (attribute, adapter,
   acquired attribute).
 
-* Enabled the viewlet related directives by default.
-
-* Added acquisition wrappers to viewlets before updating or rendering.
-
 * Made the provider directive acquisition wrap the resultant content provider
   so that simple providers that need security declarations (e.g. those that
   render pagetemplates) can work with the Zope 2 security machinery.
 
+* Added acquisition wrappers to viewlets before updating or rendering.
+
+Restructuring
+-
+
+* Enabled the viewlet related directives by default.
+
 * Added Five.browser.pagetemplatefile.ViewPageTemplateFile as an alias
   to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to
   zope.app.pagetemplate.ViewPageTemplateFile.
 
-Bugfixes
-
-
-* Made the pythonproducts monkey patching more robust by checking to
-  ensure patches aren't reapplied and cleaning up after itself.
-
 Five 1.4 (2006-05-29)
 =
 

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


[Zope-Checkins] SVN: Products.Five/branches/1.4/ Made the pythonproducts monkey patching more robust by checking to ensure patches aren't reapplied and cleaning up after itself.

2006-07-20 Thread Rocky Burt
Log message for revision 69226:
  Made the pythonproducts monkey patching more robust by checking to ensure 
patches aren't reapplied and cleaning up after itself.

Changed:
  U   Products.Five/branches/1.4/CHANGES.txt
  U   Products.Five/branches/1.4/pythonproducts.py
  U   Products.Five/branches/1.4/tests/test_pythonproducts.py

-=-
Modified: Products.Five/branches/1.4/CHANGES.txt
===
--- Products.Five/branches/1.4/CHANGES.txt  2006-07-20 12:22:36 UTC (rev 
69225)
+++ Products.Five/branches/1.4/CHANGES.txt  2006-07-20 12:22:54 UTC (rev 
69226)
@@ -20,6 +20,12 @@
   to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to
   zope.app.pagetemplate.ViewPageTemplateFile.
 
+Bugfixes
+
+
+* Made the pythonproducts monkey patching more robust by checking to
+  ensure patches aren't reapplied and cleaning up after itself.
+
 Five 1.4 (2006-05-29)
 =
 

Modified: Products.Five/branches/1.4/pythonproducts.py
===
--- Products.Five/branches/1.4/pythonproducts.py2006-07-20 12:22:36 UTC 
(rev 69225)
+++ Products.Five/branches/1.4/pythonproducts.py2006-07-20 12:22:54 UTC 
(rev 69226)
@@ -24,9 +24,13 @@
 import Products
 from App.Product import initializeProduct
 from App.ProductContext import ProductContext
+from zope.testing import cleanup
 
 _zope_app = None
 
+def isMonkeyPatched(m):
+return hasattr(m, '__five_method__')  
+
 def setupPythonProducts(appOrContext):
 """Initialize the python-packages-as-products logic
 """
@@ -52,7 +56,23 @@
 patch_ProductDispatcher__bobo_traverse__(app)
 patch_externalmethod(app)
 
+def removePatches():
+"""Remove all monkey patches.
+"""
+   
+from App.FactoryDispatcher import FactoryDispatcher, ProductDispatcher
+from App import Extensions   
+from Products.ExternalMethod import ExternalMethod
+
+if isMonkeyPatched(ProductDispatcher.__bobo_traverse__):
+ProductDispatcher.__bobo_traverse__ = _original__bobo_traverse__
 
+if isMonkeyPatched(Extensions.getPath):
+Extensions.getPath = _originalGetPath
+ExternalMethod.getPath = _originalGetPath
+
+cleanup.addCleanUp(removePatches)
+
 # BEGIN MONKEY PATCHES
 # Most of these monkey patches were repurposed from the code I 
 # wrote for Basket - Rocky
@@ -93,6 +113,10 @@
 """
 
 from App.FactoryDispatcher import FactoryDispatcher, ProductDispatcher
+
+if isMonkeyPatched(ProductDispatcher.__bobo_traverse__):
+return
+
 global _original__bobo_traverse__
 _original__bobo_traverse__ = ProductDispatcher.__bobo_traverse__
 
@@ -108,6 +132,7 @@
 
 dispatcher=dispatcher_class(product, self.aq_parent, REQUEST)
 return dispatcher.__of__(self)
+__bobo_traverse__.__five_method__ = True
 
 ProductDispatcher.__bobo_traverse__ = __bobo_traverse__
 
@@ -120,6 +145,9 @@
 
 from App import Extensions, FactoryDispatcher
 from Products.ExternalMethod import ExternalMethod
+
+if isMonkeyPatched(Extensions.getPath):
+return
 
 global _originalGetPath
 _originalGetPath = Extensions.getPath
@@ -154,5 +182,7 @@
 except:
 pass
 
+getPath.__five_method__ = True
+
 Extensions.getPath = getPath
 ExternalMethod.getPath = getPath

Modified: Products.Five/branches/1.4/tests/test_pythonproducts.py
===
--- Products.Five/branches/1.4/tests/test_pythonproducts.py 2006-07-20 
12:22:36 UTC (rev 69225)
+++ Products.Five/branches/1.4/tests/test_pythonproducts.py 2006-07-20 
12:22:54 UTC (rev 69226)
@@ -24,9 +24,10 @@
 from Products.Five.tests import testing
 sys.path.append(testing.__path__[0])
 
-def test_registerPackage():
+def test_aRegisterPackageCall():
 """
-Testing registerPackage
+Testing registerPackage.  Recently renamed method to something to
+would produce an out of order issue that breaks the test.
 
   >>> from zope.app.testing.placelesssetup import setUp, tearDown
   >>> setUp()

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


[Zope-Checkins] SVN: Zope/branches/2.9/ - Fixup usage of urljoin in webdav.davcmds

2006-07-20 Thread Sidnei da Silva
Log message for revision 69225:
  
  - Fixup usage of urljoin in webdav.davcmds
  (a shame I missed the deadline to Zope 2.9.4)
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/webdav/common.py
  U   Zope/branches/2.9/lib/python/webdav/davcmds.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===
--- Zope/branches/2.9/doc/CHANGES.txt   2006-07-20 12:09:12 UTC (rev 69224)
+++ Zope/branches/2.9/doc/CHANGES.txt   2006-07-20 12:22:36 UTC (rev 69225)
@@ -14,6 +14,13 @@
  to the rules for such a type laid out in the Python docs:
  http://docs.python.org/api/supporting-cycle-detection.html
 
+  Zope 2.9.5 (unreleased)
+
+   Bugs fixed
+
+  - Usage of 'urljoin' in 'webdav.davcmds' could lead to wrongly
+constructed urls.
+
   Zope 2.9.4 (2006/07/21)
 
Bugs fixed

Modified: Zope/branches/2.9/lib/python/webdav/common.py
===
--- Zope/branches/2.9/lib/python/webdav/common.py   2006-07-20 12:09:12 UTC 
(rev 69224)
+++ Zope/branches/2.9/lib/python/webdav/common.py   2006-07-20 12:22:36 UTC 
(rev 69225)
@@ -42,6 +42,11 @@
 return attr()
 return attr
 
+def urljoin(url, s):
+url = url.rstrip('/')
+s = s.lstrip('/')
+return '/'.join((url, s))
+
 def urlfix(url, s):
 n=len(s)
 if url[-n:]==s: url=url[:-n]

Modified: Zope/branches/2.9/lib/python/webdav/davcmds.py
===
--- Zope/branches/2.9/lib/python/webdav/davcmds.py  2006-07-20 12:09:12 UTC 
(rev 69224)
+++ Zope/branches/2.9/lib/python/webdav/davcmds.py  2006-07-20 12:22:36 UTC 
(rev 69225)
@@ -23,10 +23,9 @@
 from AccessControl import getSecurityManager
 from Acquisition import aq_parent
 from OFS.PropertySheets import DAVProperties
-from ZConfig.url import urljoin
 from zExceptions import BadRequest, Forbidden
 
-from common import absattr, aq_base, urlfix, urlbase
+from common import absattr, aq_base, urlfix, urlbase, urljoin
 from common import isDavCollection
 from common import PreconditionFailed
 from interfaces import IWriteLock
@@ -170,8 +169,8 @@
 if dflag:
 ob._p_deactivate()
 elif hasattr(ob, '__dav_resource__'):
-uri=urljoin(url, absattr(ob.id))
-depth=depth=='infinity' and depth or 0
+uri = urljoin(url, absattr(ob.getId()))
+depth = depth=='infinity' and depth or 0
 self.apply(ob, uri, depth, result, top=0)
 if dflag:
 ob._p_deactivate()
@@ -409,7 +408,7 @@
 if depth == 'infinity' and iscol:
 for ob in obj.objectValues():
 if hasattr(obj, '__dav_resource__'):
-uri = urljoin(url, absattr(ob.id))
+uri = urljoin(url, absattr(ob.getId()))
 self.apply(ob, creator, depth, token, result,
uri, top=0)
 if not top:
@@ -474,7 +473,7 @@
 if hasattr(ob, '__dav_resource__') and \
 (IWriteLock.providedBy(ob) or
  WriteLockInterface.isImplementedBy(ob)):
-uri = urljoin(url, absattr(ob.id))
+uri = urljoin(url, absattr(ob.getId()))
 self.apply(ob, token, uri, result, top=0)
 if not top:
 return result
@@ -529,7 +528,7 @@
 for ob in obj.objectValues():
 dflag = hasattr(ob,'_p_changed') and (ob._p_changed == None)
 if hasattr(ob, '__dav_resource__'):
-uri = urljoin(url, absattr(ob.id))
+uri = urljoin(url, absattr(ob.getId()))
 self.apply(ob, token, user, uri, result, top=0)
 if dflag:
 ob._p_deactivate()

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