[Zope3-checkins] CVS: Zope3/src/zope/app - _app.py:1.4.2.1 configure.zcml:1.9.2.3

Sidnei da Silva sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:41:56 -0500


Update of /cvs-repository/Zope3/src/zope/app
In directory cvs.zope.org:/tmp/cvs-serv18615/src/zope/app

Modified Files:
      Tag: paris-copypasterename-branch
	_app.py configure.zcml 
Log Message:
Updating from HEAD to make sure everything still works before merging

=== Zope3/src/zope/app/_app.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/_app.py:1.4	Mon Dec 30 22:35:06 2002
+++ Zope3/src/zope/app/_app.py	Tue Feb 11 09:40:55 2003
@@ -18,7 +18,9 @@
 
 import base64
 from StringIO import StringIO
-from zope.publisher.publish import publish as _publish
+from zope.publisher.publish import publish as _publish, debug_call
+from zope.publisher.browser import TestRequest
+from zope.app.publication.browser import BrowserPublication
 
 __metaclass__ = type
 
@@ -85,16 +87,20 @@
         self.db = database(db)
 
     def __call__(self):
+        """Get the top-level application object
+
+        The object returned is connected to an open database connection.
+        """
+        
         from zope.app.publication.zopepublication import ZopePublication
         return self.db.open().root()[ZopePublication.root_name]
 
-    __browser_pub = None
-    __TestRequest = None
-
     def _request(self,
                  path='/', stdin='', stdout=None, basic=None,
-                 environment = None, form=None):
-
+                 environment = None, form=None,
+                 request=TestRequest, publication=BrowserPublication):
+        """Create a request
+        """
 
         env = {}
 
@@ -118,21 +124,11 @@
         if basic:
             env['HTTP_AUTHORIZATION']="Basic %s" % base64.encodestring(basic)
 
-        if self.__TestRequest is None:
-            from zope.publisher.browser import TestRequest
-            from zope.app.publication.browser \
-                 import BrowserPublication
-            from zope.app.publication.zopepublication \
-                 import DebugPublication
-
-            class BrowserPublication(DebugPublication, BrowserPublication):
-                pass
 
-            self.__TestRequest = TestRequest
-            self.__browser_pub = BrowserPublication(self.db)
+        pub = publication(self.db)
 
-        request = self.__TestRequest(stdin, stdout, env)
-        request.setPublication(self.__browser_pub)
+        request = request(stdin, stdout, env)
+        request.setPublication(pub)
         if form:
             request.update(form)
 
@@ -175,19 +171,9 @@
 
         db=Pdb()
 
-        def fbreak(db, meth):
-            try:
-                meth = meth.im_func
-            except AttributeError:
-                pass
-            code = meth.func_code
-            lineno = getlineno(code)
-            filename = code.co_filename
-            db.set_break(filename,lineno)
-
         request = self._request(*args, **kw)
         fbreak(db, _publish)
-        fbreak(db, request.publication.call_wrapper.__call__)
+        fbreak(db, debug_call)
 
 ##         dbdata = {'breakpoints':(), 'env':env, 'extra': extra}
 ##         b=''
@@ -206,6 +192,19 @@
 
         print '* Type c<cr> to jump to published object call.'
         db.runcall(_publish, request)
+
+
+def fbreak(db, meth):
+    try:
+        meth = meth.im_func
+    except AttributeError:
+        pass
+    code = meth.func_code
+    lineno = getlineno(code)
+    filename = code.co_filename
+    db.set_break(filename,lineno)
+
+
 
 try:
     from codehack import getlineno


=== Zope3/src/zope/app/configure.zcml 1.9.2.2 => 1.9.2.3 ===
--- Zope3/src/zope/app/configure.zcml:1.9.2.2	Wed Feb  5 07:42:55 2003
+++ Zope3/src/zope/app/configure.zcml	Tue Feb 11 09:40:55 2003
@@ -88,7 +88,6 @@
   <include package="zope.app.publisher" />
   <include package="zope.app.rdb" />
   <include package="zope.app.traversing" />
-  <include package="zope.app.publication" />
   <include package="zope.app.form" />
   <include package="zope.app.cache" />
   <include package="zope.app.dublincore" />
@@ -101,5 +100,7 @@
 
   <include package="zope.app.browser" />
   <include package="zope.app.ftp" />
+  <include package="zope.app.xmlrpc" />
+  <include package="zope.app.http" />
 
 </zopeConfigure>