[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - Browser.py:1.1.2.1
Shane Hathaway
shane@digicool.com
Wed, 26 Sep 2001 13:38:19 -0400
Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv15263
Added Files:
Tag: ComponentArchitecture-branch
Browser.py
Log Message:
Added BrowserPublish interface.
=== Added File Zope/lib/python/ZPublisher/Browser.py ===
import Interface
import ComponentArchitecture
from ComponentArchitecture.Content import LeafContent
class HTTPException (Exception):
status = 500
description = 'Internal Server Error'
class NotFound (Exception):
status = 404
description = 'Not found'
class BrowserPublish (Interface.Base):
def __bobo_traverse__(self, request, name):
"""
"""
def __browser_default__(self, request):
"""
"""
class LeafContentBrowserPublish:
"""
Adapter for content without items.
"""
__implements__ = BrowserPublish
def __init__(self, content):
self._content = content
def __bobo_traverse__(self, request, name):
if name[:3] == '(p)':
return ComponentArchitecture.getPresentation(
self._content, name[3:], BrowserPublish)
else:
# Can't traverse beyond leaf content.
raise NotFound, name
def __browser_default__(self, request):
p = ComponentArchitecture.getPresentation(
self._content, '', BrowserPublish)
return p.__browser_default__(request)
ComponentArchitecture.providePresentation(
LeafContent, '_publish', BrowserPublish, LeafContentBrowserPublish)