[Zope-Checkins] SVN: Zope/trunk/ZOPE_APP_DEPENDENCIES.rst Note current status; document script for checking direct deps.

2009-09-18 Thread Tres Seaver
Log message for revision 104346:
  Note current status;  document script for checking direct deps.

Changed:
  U   Zope/trunk/ZOPE_APP_DEPENDENCIES.rst

-=-
Modified: Zope/trunk/ZOPE_APP_DEPENDENCIES.rst
===
--- Zope/trunk/ZOPE_APP_DEPENDENCIES.rst2009-09-18 15:12:44 UTC (rev 
104345)
+++ Zope/trunk/ZOPE_APP_DEPENDENCIES.rst2009-09-18 15:18:53 UTC (rev 
104346)
@@ -16,7 +16,8 @@
   * Products/Five/browser/doc/products/ViewsTutorial/configure.zcml
 
 - [_] zope.app.form
-  o Products.Five.form.*
+  o Products.Five.form.* (should be factored out into a separate
+package, maybe ``five.forms``)
 
 - [X] zope.app.pagetemplate 
   * Products.PageTemplates.Expressions
@@ -25,22 +26,38 @@
 
 - [_] zope.app.publication 
   o ZPublisher.BaseRequest (for ``EndRequestEvent``)
-  o Products.Five.component (for ``IBeginRequestEvent``,
-``IEndRequestEvent``, and ``BeforeTraverseEvent``.)
+  o Products.Five.component (for ``BeforeTraverseEvent``)
 
 - [X] zope.app.publisher 
   * ZPublisher.BaseRequest
-  o Products.Five.browser.adding (for ``getMenu``)
-  o Products/Five/browser/configure.zcml (for ``IMenuItemType``,
+  * Products.Five.browser.adding (for ``getMenu``)
+  * Products/Five/browser/configure.zcml (for ``IMenuItemType``,
 ``MenuAccessView``, and ``IMenuAccessView``)
-  o Products.Five.viewlet.metaconfigure (for ``viewmeta``)
-  o Products.Five.form.metaconfigure (for ``menuItemDirective``)
-  o Products.Five.fivedirectives (for ``IBasicResourceInformation``)
+  * Products.Five.viewlet.metaconfigure (for ``viewmeta``)
+  * Products.Five.form.metaconfigure (for ``menuItemDirective``)
+  * Products.Five.fivedirectives (for ``IBasicResourceInformation``)
 
 - [_] zope.app.schema 
-  o Products.Five
+  o Products.Five (imports ``zope.app.schema.vocabulary`` for
+side-effects ?!).
 
+- [_] zope.app.twisted
+  o Zope2.Startup.datatypes (conditionally imports ``ServerFactory``)
+  o Zope2.Startup.handlers (conditionally imports ``ServerType``,
+  ``SSLServerType``, ``IServerType``;  worse, conditionally imports
+  ``zope.app.twisted.main`` for side effects, which includes pulling
+  back ``zope.app.appsetup`` as well as adding ``zope.app.wsgi``?!)
 
+This shell script can be used to verify the direct dependencies::
+
+  #! /bin/sh
+  for f in $(find src/ -name "*.py" | xargs grep -l "zope\.app"); do
+  echo 
+  echo $f
+  echo 
+  grep "zope\.app" $f
+   done
+
 Zope2 has transitive dependencies on these packages:
 
 - [_] zope.app.applicationcontrol 

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


[Zope-Checkins] SVN: Zope/trunk/ZOPE_APP_DEPENDENCIES.rst Include analysis of ZCML / doctests.

2009-09-18 Thread Tres Seaver
Log message for revision 104349:
  Include analysis of ZCML / doctests.

Changed:
  U   Zope/trunk/ZOPE_APP_DEPENDENCIES.rst

-=-
Modified: Zope/trunk/ZOPE_APP_DEPENDENCIES.rst
===
--- Zope/trunk/ZOPE_APP_DEPENDENCIES.rst2009-09-18 15:31:18 UTC (rev 
104348)
+++ Zope/trunk/ZOPE_APP_DEPENDENCIES.rst2009-09-18 15:31:45 UTC (rev 
104349)
@@ -25,8 +25,10 @@
   * Products.Five.browser.metaconfigure
 
 - [_] zope.app.publication 
-  o ZPublisher.BaseRequest (for ``EndRequestEvent``)
-  o Products.Five.component (for ``BeforeTraverseEvent``)
+  o ZPublisher.BaseRequest (imports ``EndRequestEvent``)
+  o Products.Five.component (imports ``BeforeTraverseEvent``;
+ZCML registers subscribers for ``IBeforeTraverseEvent``
+and ``IEndRequestEvent``)
 
 - [X] zope.app.publisher 
   * ZPublisher.BaseRequest
@@ -50,8 +52,12 @@
 
 This shell script can be used to verify the direct dependencies::
 
-  #! /bin/sh
-  for f in $(find src/ -name "*.py" | xargs grep -l "zope\.app"); do
+  #! /bin/bash
+  python=$(find src/ -name "*.py" | xargs grep -l "zope\.app")
+  zcml=$(find src/ -name "*.zcml" | xargs grep -l "zope\.app")
+  doctest=$(find src/ -name "*.txt" | grep -v "egg-info" |
+xargs grep -l "zope\.app")
+  for f in $python $zcml $doctest; do
   echo 
   echo $f
   echo 
@@ -63,6 +69,7 @@
 - [_] zope.app.applicationcontrol 
   o zope.traversing
   o zope.app.publication
+  o zope.app.twisted
 
 - [_] zope.app.basicskin 
   o zope.app.form

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


[Zope-Checkins] SVN: Zope/trunk/check_zope_app_deps.sh Temporary script for checking dependencies on zope.app.*

2009-09-18 Thread Tres Seaver
Log message for revision 104352:
  Temporary script for checking dependencies on zope.app.*

Changed:
  A   Zope/trunk/check_zope_app_deps.sh

-=-
Added: Zope/trunk/check_zope_app_deps.sh
===
--- Zope/trunk/check_zope_app_deps.sh   (rev 0)
+++ Zope/trunk/check_zope_app_deps.sh   2009-09-18 15:59:40 UTC (rev 104352)
@@ -0,0 +1,12 @@
+#! /bin/bash
+python=$(find src/ -name "*.py" | xargs grep -l "zope\.app")
+zcml=$(find src/ -name "*.zcml" | xargs grep -l "zope\.app")
+doctest=$(find src/ -name "*.txt" | grep -v "egg-info" |
+   xargs grep -l "zope\.app")
+for f in $python $zcml $doctest; do
+echo 
+echo $f
+echo 
+grep "zope\.app" $f
+done
+

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


[Zope-Checkins] SVN: Zope/trunk/ Removed experimental support for configuring the Twisted HTTP server.

2009-09-18 Thread Tres Seaver
Log message for revision 104359:
  Removed experimental support for configuring the Twisted HTTP server.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Lifetime/__init__.py
  U   Zope/trunk/src/Zope2/Startup/__init__.py
  U   Zope/trunk/src/Zope2/Startup/datatypes.py
  U   Zope/trunk/src/Zope2/Startup/handlers.py
  U   Zope/trunk/src/Zope2/Startup/zopeschema.xml
  U   Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2009-09-18 19:43:23 UTC (rev 104358)
+++ Zope/trunk/doc/CHANGES.rst  2009-09-18 19:46:22 UTC (rev 104359)
@@ -11,6 +11,9 @@
 Restructuring
 +
 
+- Removed experimental support for configuring the Twisted HTTP server
+  as an alternative to ``ZServer``.
+
 - Moved ``Products/Five/security.py`` into the AccessControl package.
 
 - Moved ``Products/Five/traversing.zcml`` directly into the configure.zcml.

Modified: Zope/trunk/src/Lifetime/__init__.py
===
--- Zope/trunk/src/Lifetime/__init__.py 2009-09-18 19:43:23 UTC (rev 104358)
+++ Zope/trunk/src/Lifetime/__init__.py 2009-09-18 19:46:22 UTC (rev 104359)
@@ -31,11 +31,6 @@
 import ZServer
 ZServer.exit_code = exit_code
 _shutdown_phase = 1
-try:
-from twisted.internet import reactor
-reactor.callLater(0.1, reactor.stop)
-except ImportError:
-pass
 if fast:
 # Someone wants us to shutdown fast. This is hooked into SIGTERM - so
 # possibly the system is going down and we can expect a SIGKILL within

Modified: Zope/trunk/src/Zope2/Startup/__init__.py
===
--- Zope/trunk/src/Zope2/Startup/__init__.py2009-09-18 19:43:23 UTC (rev 
104358)
+++ Zope/trunk/src/Zope2/Startup/__init__.py2009-09-18 19:46:22 UTC (rev 
104359)
@@ -20,12 +20,6 @@
 import socket
 from re import compile
 from socket import gethostbyaddr
-try:
-import twisted.internet.reactor
-_use_twisted = True
-except ImportError:
-_use_twisted = True
-
 
 import ZConfig
 from ZConfig.components.logger import loghandler
@@ -94,8 +88,7 @@
 self.serverListen()
 from App.config import getConfiguration
 config = getConfiguration()
-if not config.twisted_servers:
-self.registerSignals()
+self.registerSignals()
 # emit a "ready" message in order to prevent the kinds of emails
 # to the Zope maillist in which people claim that Zope has "frozen"
 # after it has emitted ZServer messages.
@@ -109,21 +102,9 @@
 from App.config import getConfiguration
 config = getConfiguration()
 import ZServer
-if config.twisted_servers and config.servers:
-raise ZConfig.ConfigurationError(
-"You can't run both ZServer servers and twisted servers.")
-if config.twisted_servers:
-if not _use_twisted:
-raise ZConfig.ConfigurationError(
-"You do not have twisted installed.")
-twisted.internet.reactor.run()
-# Storing the exit code in the ZServer even for twisted, 
-# but hey, it works...
-sys.exit(ZServer.exit_code)
-else:
-import Lifetime
-Lifetime.loop()
-sys.exit(ZServer.exit_code)
+import Lifetime
+Lifetime.loop()
+sys.exit(ZServer.exit_code)
 finally:
 self.shutdown()
 

Modified: Zope/trunk/src/Zope2/Startup/datatypes.py
===
--- Zope/trunk/src/Zope2/Startup/datatypes.py   2009-09-18 19:43:23 UTC (rev 
104358)
+++ Zope/trunk/src/Zope2/Startup/datatypes.py   2009-09-18 19:46:22 UTC (rev 
104359)
@@ -325,12 +325,3 @@
 return getattr(m, name)
 except:
 return OFS.Uninstalled.Broken(jar, None, (module, name))
-
-try:
-from zope.app.twisted.server import ServerFactory
-class TwistedServerFactory(ServerFactory):
-pass
-except ImportError:
-class TwistedServerFactory:
-def __init__(self, section):
-raise ImportError("You do not have twisted installed.")

Modified: Zope/trunk/src/Zope2/Startup/handlers.py
===
--- Zope/trunk/src/Zope2/Startup/handlers.py2009-09-18 19:43:23 UTC (rev 
104358)
+++ Zope/trunk/src/Zope2/Startup/handlers.py2009-09-18 19:46:22 UTC (rev 
104359)
@@ -5,29 +5,6 @@
 from re import compile
 from socket import gethostbyaddr
 
-try:
-import twisted.internet
-from twisted.application.service import MultiService
-import zope.app.twisted.main
-
-import twisted.web2.wsgi
-import t

[Zope-Checkins] SVN: Zope/trunk/ Separate clearing and closing a request.

2009-09-18 Thread Martijn Pieters
Log message for revision 104360:
  Separate clearing and closing a request.
  
  Clearing frees resources, closing also sends out the end-request event. Clones
  of the current request need to be cleared, only the actual current request
  needs to be closed. Fixes LP #414757.
  

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

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2009-09-18 19:46:22 UTC (rev 104359)
+++ Zope/trunk/doc/CHANGES.rst  2009-09-18 20:16:03 UTC (rev 104360)
@@ -51,6 +51,8 @@
 Bugs Fixed
 ++
 
+- LP #414757: Don't send a request closed event from a cloned request.
+
 - LP #418454: FTP server did not work with Python 2.6.X
 
 - Fixed issue with sending text containing ':' from MailHost.

Modified: Zope/trunk/src/ZPublisher/BaseRequest.py
===
--- Zope/trunk/src/ZPublisher/BaseRequest.py2009-09-18 19:46:22 UTC (rev 
104359)
+++ Zope/trunk/src/ZPublisher/BaseRequest.py2009-09-18 20:16:03 UTC (rev 
104360)
@@ -206,11 +206,14 @@
 else: other.update(kw)
 self.other=other
 
-def close(self):
+def clear(self):
 self.other.clear()
-notify(EndRequestEvent(None, self))
 self._held=None
 
+def close(self):
+self.clear()
+notify(EndRequestEvent(None, self))
+
 def processInputs(self):
 """Do any input processing that could raise errors
 """

Modified: Zope/trunk/src/ZPublisher/HTTPRequest.py
===
--- Zope/trunk/src/ZPublisher/HTTPRequest.py2009-09-18 19:46:22 UTC (rev 
104359)
+++ Zope/trunk/src/ZPublisher/HTTPRequest.py2009-09-18 20:16:03 UTC (rev 
104360)
@@ -184,7 +184,7 @@
 r.retry_count = self.retry_count
 return r
 
-def close(self):
+def clear(self):
 # Clear all references to the input stream, possibly
 # removing tempfiles.
 self.stdin = None
@@ -194,7 +194,7 @@
 # one.  Without this, there's the possibility of memory leaking
 # after every request.
 self._lazies = {}
-BaseRequest.close(self)
+BaseRequest.clear(self)
 
 def setServerURL(self, protocol=None, hostname=None, port=None):
 """ Set the parts of generated URLs. """
@@ -1171,7 +1171,7 @@
 except:
 rsp.exception()
 if object is None:
-req.close()
+req.clear()
 raise rsp.errmsg, sys.exc_info()[1]
 
 # The traversal machinery may return a "default object"
@@ -1191,7 +1191,7 @@
 if name != os.path.split(path)[-1]:
 object = req.PARENTS[0]
 
-req.close()
+req.clear()
 return object
 
 def clone(self):

Modified: Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
===
--- Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py  2009-09-18 19:46:22 UTC 
(rev 104359)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py  2009-09-18 20:16:03 UTC 
(rev 104360)
@@ -975,7 +975,20 @@
 clone = request.clone()
 self.failUnless(IFoo.providedBy(clone))
 
+def test_resolve_url_doesnt_send_endrequestevent(self):
+import zope.event
+events = []
+zope.event.subscribers.append(events.append)
+request = self._makeOne()
+request['PARENTS'] = [object()]
+try:
+request.resolve_url(request.script + '/')
+finally:
+zope.event.subscribers.remove(events.append)
+self.failIf(len(events),
+"HTTPRequest.resolve_url should not emit events")
 
+
 TEST_ENVIRON = {
 'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
 'REQUEST_METHOD': 'POST',

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


[Zope-Checkins] SVN: Zope/branches/2.12/ Backport r104360 from trunk: do not emit the request closed event from a request clone

2009-09-18 Thread Martijn Pieters
Log message for revision 104361:
  Backport r104360 from trunk: do not emit the request closed event from a 
request clone

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

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===
--- Zope/branches/2.12/doc/CHANGES.rst  2009-09-18 20:16:03 UTC (rev 104360)
+++ Zope/branches/2.12/doc/CHANGES.rst  2009-09-18 20:26:31 UTC (rev 104361)
@@ -15,7 +15,12 @@
 
   - ZODB3 = 3.9.0
 
+Bugs Fixed
+++
 
+- LP #414757 (backported from Zope trunk): don't emit a IEndRequestEvent when
+  clearing a cloned request.
+
 Zope 2.12.0 c1 (2009/09/04)
 ---
 

Modified: Zope/branches/2.12/src/ZPublisher/BaseRequest.py
===
--- Zope/branches/2.12/src/ZPublisher/BaseRequest.py2009-09-18 20:16:03 UTC 
(rev 104360)
+++ Zope/branches/2.12/src/ZPublisher/BaseRequest.py2009-09-18 20:26:31 UTC 
(rev 104361)
@@ -206,11 +206,14 @@
 else: other.update(kw)
 self.other=other
 
-def close(self):
+def clear(self):
 self.other.clear()
-notify(EndRequestEvent(None, self))
 self._held=None
 
+def close(self):
+self.clear()
+notify(EndRequestEvent(None, self))
+
 def processInputs(self):
 """Do any input processing that could raise errors
 """

Modified: Zope/branches/2.12/src/ZPublisher/HTTPRequest.py
===
--- Zope/branches/2.12/src/ZPublisher/HTTPRequest.py2009-09-18 20:16:03 UTC 
(rev 104360)
+++ Zope/branches/2.12/src/ZPublisher/HTTPRequest.py2009-09-18 20:26:31 UTC 
(rev 104361)
@@ -184,7 +184,7 @@
 r.retry_count = self.retry_count
 return r
 
-def close(self):
+def clear(self):
 # Clear all references to the input stream, possibly
 # removing tempfiles.
 self.stdin = None
@@ -194,7 +194,7 @@
 # one.  Without this, there's the possibility of memory leaking
 # after every request.
 self._lazies = {}
-BaseRequest.close(self)
+BaseRequest.clear(self)
 
 def setServerURL(self, protocol=None, hostname=None, port=None):
 """ Set the parts of generated URLs. """
@@ -1171,7 +1171,7 @@
 except:
 rsp.exception()
 if object is None:
-req.close()
+req.clear()
 raise rsp.errmsg, sys.exc_info()[1]
 
 # The traversal machinery may return a "default object"
@@ -1191,7 +1191,7 @@
 if name != os.path.split(path)[-1]:
 object = req.PARENTS[0]
 
-req.close()
+req.clear()
 return object
 
 def clone(self):

Modified: Zope/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py
===
--- Zope/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py  2009-09-18 
20:16:03 UTC (rev 104360)
+++ Zope/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py  2009-09-18 
20:26:31 UTC (rev 104361)
@@ -975,7 +975,20 @@
 clone = request.clone()
 self.failUnless(IFoo.providedBy(clone))
 
+def test_resolve_url_doesnt_send_endrequestevent(self):
+import zope.event
+events = []
+zope.event.subscribers.append(events.append)
+request = self._makeOne()
+request['PARENTS'] = [object()]
+try:
+request.resolve_url(request.script + '/')
+finally:
+zope.event.subscribers.remove(events.append)
+self.failIf(len(events),
+"HTTPRequest.resolve_url should not emit events")
 
+
 TEST_ENVIRON = {
 'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
 'REQUEST_METHOD': 'POST',

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


[Zope-Checkins] SVN: Zope/branches/2.11/ Backport r104360 from trunk: do not emit the request closed event from a request clone

2009-09-18 Thread Martijn Pieters
Log message for revision 104363:
  Backport r104360 from trunk: do not emit the request closed event from a 
request clone

Changed:
  U   Zope/branches/2.11/doc/CHANGES.txt
  U   Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py
  U   Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/branches/2.11/doc/CHANGES.txt
===
--- Zope/branches/2.11/doc/CHANGES.txt  2009-09-18 20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/doc/CHANGES.txt  2009-09-18 20:55:40 UTC (rev 104363)
@@ -4,6 +4,13 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
+  Zope 2.11.5 (Unreleased)
+
+Bugs Fixed
+
+  - LP #414757 (backported from Zope trunk): don't emit a IEndRequestEvent
+when clearing a cloned request.
+
   Zope 2.11.4 (2009/08/06)
 
 Restructuring

Modified: Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py
===
--- Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py 2009-09-18 
20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py 2009-09-18 
20:55:40 UTC (rev 104363)
@@ -203,11 +203,14 @@
 else: other.update(kw)
 self.other=other
 
-def close(self):
+def clear(self):
 self.other.clear()
-notify(EndRequestEvent(None, self))
 self._held=None
 
+def close(self):
+self.clear()
+notify(EndRequestEvent(None, self))
+
 def processInputs(self):
 """Do any input processing that could raise errors
 """

Modified: Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py
===
--- Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py 2009-09-18 
20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py 2009-09-18 
20:55:40 UTC (rev 104363)
@@ -149,7 +149,7 @@
 r.retry_count=self.retry_count
 return r
 
-def close(self):
+def clear(self):
 # Clear all references to the input stream, possibly
 # removing tempfiles.
 self.stdin = None
@@ -159,7 +159,7 @@
 # one.  Without this, there's the possibility of memory leaking
 # after every request.
 self._lazies = {}
-BaseRequest.close(self)
+BaseRequest.clear(self)
 
 def setServerURL(self, protocol=None, hostname=None, port=None):
 """ Set the parts of generated URLs. """
@@ -1082,7 +1082,7 @@
 try: object=req.traverse(path)
 except: rsp.exception()
 if object is None:
-req.close()
+req.clear()
 raise rsp.errmsg, sys.exc_info()[1]
 
 # The traversal machinery may return a "default object"
@@ -1100,7 +1100,7 @@
 if name != os.path.split(path)[-1]:
 object=req.PARENTS[0]
 
-req.close()
+req.clear()
 return object
 
 

Modified: Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py
===
--- Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py   
2009-09-18 20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py   
2009-09-18 20:55:40 UTC (rev 104363)
@@ -75,6 +75,20 @@
 self.assertEqual( user_id_x, user_id )
 self.assertEqual( password_x, password )
 
+def test_resolve_url_doesnt_send_endrequestevent(self):
+import zope.event
+events = []
+zope.event.subscribers.append(events.append)
+request = self._makeOne()
+request['PARENTS'] = [object()]
+try:
+request.resolve_url(request.script + '/')
+finally:
+zope.event.subscribers.remove(events.append)
+self.failIf(len(events),
+"HTTPRequest.resolve_url should not emit events")
+
+
 class RecordTests( unittest.TestCase ):
 
 def test_repr( self ):

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


[Zope-Checkins] SVN: Zope/branches/2.10/ Backport r104360 from trunk: do not emit the request closed event from a request clone

2009-09-18 Thread Martijn Pieters
Log message for revision 104364:
  Backport r104360 from trunk: do not emit the request closed event from a 
request clone

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
  U   Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===
--- Zope/branches/2.10/doc/CHANGES.txt  2009-09-18 20:55:40 UTC (rev 104363)
+++ Zope/branches/2.10/doc/CHANGES.txt  2009-09-18 20:58:31 UTC (rev 104364)
@@ -4,6 +4,13 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
+  Zope 2.10.10 (Unreleased)
+
+Bugs fixed
+
+  - LP #414757 (backported from Zope trunk): don't emit a IEndRequestEvent
+when clearing a cloned request.
+
   Zope 2.10.9 (2009/08/06)
 
 Restructuring

Modified: Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
===
--- Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py 2009-09-18 
20:55:40 UTC (rev 104363)
+++ Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py 2009-09-18 
20:58:31 UTC (rev 104364)
@@ -203,11 +203,14 @@
 else: other.update(kw)
 self.other=other
 
-def close(self):
+def clear(self):
 self.other.clear()
-notify(EndRequestEvent(None, self))
 self._held=None
 
+def close(self):
+self.clear()
+notify(EndRequestEvent(None, self))
+
 def processInputs(self):
 """Do any input processing that could raise errors
 """

Modified: Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py
===
--- Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py 2009-09-18 
20:55:40 UTC (rev 104363)
+++ Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py 2009-09-18 
20:58:31 UTC (rev 104364)
@@ -138,7 +138,7 @@
 r.retry_count=self.retry_count
 return r
 
-def close(self):
+def clear(self):
 # Clear all references to the input stream, possibly
 # removing tempfiles.
 self.stdin = None
@@ -148,7 +148,7 @@
 # one.  Without this, there's the possibility of memory leaking
 # after every request.
 self._lazies = {}
-BaseRequest.close(self)
+BaseRequest.clear(self)
 
 def setServerURL(self, protocol=None, hostname=None, port=None):
 """ Set the parts of generated URLs. """
@@ -1049,7 +1049,7 @@
 try: object=req.traverse(path)
 except: rsp.exception()
 if object is None:
-req.close()
+req.clear()
 raise rsp.errmsg, sys.exc_info()[1]
 
 # The traversal machinery may return a "default object"
@@ -1067,7 +1067,7 @@
 if name != os.path.split(path)[-1]:
 object=req.PARENTS[0]
 
-req.close()
+req.clear()
 return object
 
 

Modified: Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py
===
--- Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py   
2009-09-18 20:55:40 UTC (rev 104363)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py   
2009-09-18 20:58:31 UTC (rev 104364)
@@ -66,6 +66,20 @@
 self.assertEqual( user_id_x, user_id )
 self.assertEqual( password_x, password )
 
+def test_resolve_url_doesnt_send_endrequestevent(self):
+import zope.event
+events = []
+zope.event.subscribers.append(events.append)
+request = self._makeOne()
+request['PARENTS'] = [object()]
+try:
+request.resolve_url(request.script + '/')
+finally:
+zope.event.subscribers.remove(events.append)
+self.failIf(len(events),
+"HTTPRequest.resolve_url should not emit events")
+
+
 class RecordTests( unittest.TestCase ):
 
 def test_repr( self ):

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


[Zope-Checkins] SVN: Zope/trunk/ Cloned ``ZopeVocabularyRegistry`` from ``zope.app.schema``.

2009-09-18 Thread Tres Seaver
Log message for revision 104366:
  Cloned ``ZopeVocabularyRegistry`` from ``zope.app.schema``.
  
  o Added "sane" registration of it during initialization of Five, instead
of registering it via import side effects.
  

Changed:
  U   Zope/trunk/ZOPE_APP_DEPENDENCIES.rst
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Products/Five/__init__.py
  A   Zope/trunk/src/Products/Five/schema.py
  A   Zope/trunk/src/Products/Five/tests/test_schema.py

-=-
Modified: Zope/trunk/ZOPE_APP_DEPENDENCIES.rst
===
--- Zope/trunk/ZOPE_APP_DEPENDENCIES.rst2009-09-18 22:27:17 UTC (rev 
104365)
+++ Zope/trunk/ZOPE_APP_DEPENDENCIES.rst2009-09-18 22:40:23 UTC (rev 
104366)
@@ -39,13 +39,13 @@
   * Products.Five.form.metaconfigure (for ``menuItemDirective``)
   * Products.Five.fivedirectives (for ``IBasicResourceInformation``)
 
-- [_] zope.app.schema 
-  o Products.Five (imports ``zope.app.schema.vocabulary`` for
+- [X] zope.app.schema 
+  * Products.Five (imports ``zope.app.schema.vocabulary`` for
 side-effects ?!).
 
-- [_] zope.app.twisted
-  o Zope2.Startup.datatypes (conditionally imports ``ServerFactory``)
-  o Zope2.Startup.handlers (conditionally imports ``ServerType``,
+- [X] zope.app.twisted
+  * Zope2.Startup.datatypes (conditionally imports ``ServerFactory``)
+  * Zope2.Startup.handlers (conditionally imports ``ServerType``,
   ``SSLServerType``, ``IServerType``;  worse, conditionally imports
   ``zope.app.twisted.main`` for side effects, which includes pulling
   back ``zope.app.appsetup`` as well as adding ``zope.app.wsgi``?!)

Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2009-09-18 22:27:17 UTC (rev 104365)
+++ Zope/trunk/doc/CHANGES.rst  2009-09-18 22:40:23 UTC (rev 104366)
@@ -11,6 +11,9 @@
 Restructuring
 +
 
+- Cloned ``ZopeVocabularyRegistry`` from ``zope.app.schema``, and added
+  sane registration of it during initialization of Five.
+
 - Removed experimental support for configuring the Twisted HTTP server
   as an alternative to ``ZServer``.
 

Modified: Zope/trunk/src/Products/Five/__init__.py
===
--- Zope/trunk/src/Products/Five/__init__.py2009-09-18 22:27:17 UTC (rev 
104365)
+++ Zope/trunk/src/Products/Five/__init__.py2009-09-18 22:40:23 UTC (rev 
104366)
@@ -22,13 +22,14 @@
 from Products.Five.browser import BrowserView
 from Products.Five.skin.standardmacros import StandardMacros
 
-# hook up ZopeVocabularyRegistry
-import zope.app.schema.vocabulary
-
 # load the site's ZCML tree (usually site.zcml) upon product
 # initialization
 def initialize(context):
+from zope.schema.vocabulary import setVocabularyRegistry
+from Products.Five.schema import Zope2VocabularyRegistry
+
 zcml.load_site()
+setVocabularyRegistry(Zope2VocabularyRegistry())
 
 # some convenience methods/decorators
 

Added: Zope/trunk/src/Products/Five/schema.py
===
--- Zope/trunk/src/Products/Five/schema.py  (rev 0)
+++ Zope/trunk/src/Products/Five/schema.py  2009-09-18 22:40:23 UTC (rev 
104366)
@@ -0,0 +1,36 @@
+##
+#
+# Copyright (c) 2004, 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.
+#
+##
+"""Five-specific schema support
+
+$Id$
+"""
+from zope.component import getUtility
+from zope.interface import implements
+from zope.schema.interfaces import IVocabularyRegistry
+from zope.schema.interfaces import IVocabularyFactory
+
+class Zope2VocabularyRegistry(object):
+"""IVocabularyRegistry that supports global and local utilities.
+
+Cloned from the version in zope.app.schema.vocabulary:  it was the
+only feature in that package!
+"""
+implements(IVocabularyRegistry)
+__slots__ = ()
+
+def get(self, context, name):
+"""See zope.schema.interfaces.IVocabularyRegistry.
+"""
+factory = getUtility(IVocabularyFactory, name)
+return factory(context)

Added: Zope/trunk/src/Products/Five/tests/test_schema.py
===
--- Zope/trunk/src/Products/Five/tests/test_schema.py   
(rev 0)
+++ Zope/trunk/src/Products/Five/tests/t