[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/Browser - Publication.py:1.1.2.1
Jim Fulton
jim@zope.com
Sat, 16 Mar 2002 09:44:00 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/Browser
In directory cvs.zope.org:/tmp/cvs-serv24057/python/Zope/App/ZopePublication/Browser
Added Files:
Tag: Zope-3x-branch
Publication.py
Log Message:
Checking in partial publisher refactoring on the
Zope3-publisher-refactor-branch branch to facilitate collaboration
with Stephan.
=== Added File Zope3/lib/python/Zope/App/ZopePublication/Browser/Publication.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
#
##############################################################################
"""
Revision information:
$Id: Publication.py,v 1.1.2.1 2002/03/16 14:43:59 jim Exp $
"""
from Zope.App.ZopePublication.HTTP.Publication import ZopeHTTPPublication
class BrowserPublication(ZopeHTTPPublication):
"""Web browser publication handling."""
def getDefaultTraversal(self, request, ob):
r = ()
if IBrowserPublisher.isImplementedBy(ob):
r = ob.browser_default(request)
else:
adapter = getRequestView(ob, '_traverse', request , None)
if adapter is not None:
r = adapter.browser_default(request)
else:
return (ob, None)
if r[0] is ob: return r
wrapped = wrapper.Wrapper(r[0], ob, name=None)
getSecurityManager().validate(None, wrapped)
return (wrapped, r[1])
# For now, have a factory that returns a singleton
class PublicationFactory:
def __init__(self, db):
self.__pub = BrowserPublication(db)
def __call__(self):
return self.__pub