[Zope3-checkins] SVN: Zope3/branches/ajung-target-requestpublication-next-try-branch/src/zope/app/publication/httpfactory.py replace chooseClasses() implementation with the new RequestPublicationRegistry

Andreas Jung andreas at andreas-jung.com
Fri Oct 7 09:06:22 EDT 2005


Log message for revision 38877:
  replace chooseClasses() implementation with the new RequestPublicationRegistry
  

Changed:
  U   Zope3/branches/ajung-target-requestpublication-next-try-branch/src/zope/app/publication/httpfactory.py

-=-
Modified: Zope3/branches/ajung-target-requestpublication-next-try-branch/src/zope/app/publication/httpfactory.py
===================================================================
--- Zope3/branches/ajung-target-requestpublication-next-try-branch/src/zope/app/publication/httpfactory.py	2005-10-07 12:22:46 UTC (rev 38876)
+++ Zope3/branches/ajung-target-requestpublication-next-try-branch/src/zope/app/publication/httpfactory.py	2005-10-07 13:06:22 UTC (rev 38877)
@@ -19,16 +19,10 @@
 
 from zope import component, interface
 
-from zope.publisher.http import HTTPRequest
-from zope.publisher.browser import BrowserRequest
 from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.publisher.xmlrpc import XMLRPCRequest
 
 from zope.app.publication import interfaces
-from zope.app.publication.http import HTTPPublication
-from zope.app.publication.browser import BrowserPublication, setDefaultSkin
-from zope.app.publication.xmlrpc import XMLRPCPublication
-from zope.app.publication.soap import SOAPPublication
+from zope.app.publication.browser import setDefaultSkin
 
 
 def chooseClasses(method, environment):
@@ -36,34 +30,10 @@
 
     content_type = environment.get('CONTENT_TYPE', '')
     factory = getFactoryRegistry().lookup(method, content_type, environment)
+    request_class, publication = factory()
+    return request_class, publication
 
-    if not factory:
-        raise RuntimeError('nothing found')
-    return factory()
 
-    if method in ('GET', 'POST', 'HEAD'):
-        content_type = environment.get('CONTENT_TYPE', '')
-        if method == 'POST' and content_type.startswith('text/xml'):
-            soap_req = component.queryUtility(interfaces.ISOAPRequestFactory)
-            if environment.get('HTTP_SOAPACTION') and soap_req is not None:
-                request_class = soap_req
-                publication_class = SOAPPublication
-            else:
-                request_class = component.queryUtility(
-                    interfaces.IXMLRPCRequestFactory, default=XMLRPCRequest)
-                publication_class = XMLRPCPublication
-        else:
-            request_class = component.queryUtility(
-                interfaces.IBrowserRequestFactory, default=BrowserRequest)
-            publication_class = BrowserPublication
-    else:
-        request_class = component.queryUtility(
-            interfaces.IHTTPRequestFactory, default=HTTPRequest)
-        publication_class = HTTPPublication
-
-    return request_class, publication_class
-
-
 class HTTPPublicationRequestFactory(object):
     interface.implements(interfaces.IPublicationRequestFactory)
 



More information about the Zope3-Checkins mailing list