[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - BrowserView.py:1.1.2.1 IBrowserPresentation.py:1.1.2.1 IBrowserView.py:1.1.2.1 BrowserRequest.py:1.1.4.12.10.1 metaConfigure.py:1.1.2.16.8.1
Jim Fulton
jim@zope.com
Wed, 29 May 2002 11:10:24 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/Publisher/Browser
Modified Files:
Tag: Zope3InWonderland-branch
BrowserRequest.py metaConfigure.py
Added Files:
Tag: Zope3InWonderland-branch
BrowserView.py IBrowserPresentation.py IBrowserView.py
Log Message:
- Added permission_id attribute to adapter and utility directives.
- Got rid of old getView, getResource, and getDefaultViewName.
Renamed getRequestView to getView (and so on).
Changed view interface to use context, rather than getContext.
Introduced notion of presentation types (e.g. IBrowserPresentation,
which is cleaner than IBrowserPublisher).
- Began converting to get/queryFoo, which is much nicer.
- Many formatting fixups.
=== Added File Zope3/lib/python/Zope/Publisher/Browser/BrowserView.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""
$Id: BrowserView.py,v 1.1.2.1 2002/05/29 15:09:53 jim Exp $
"""
__metaclass__ = type # All classes are new style when run with Python 2.2+
from IBrowserView import IBrowserView
class BrowserView:
__implements__ = IBrowserView
def __init__(self, context, request):
self.context = context
self.request = request
=== Added File Zope3/lib/python/Zope/Publisher/Browser/IBrowserPresentation.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""
$Id: IBrowserPresentation.py,v 1.1.2.1 2002/05/29 15:09:53 jim Exp $
"""
from Zope.ComponentArchitecture.IPresentation import IPresentation
class IBrowserPresentation(IPresentation):
"""Browser presentations are for interaction with user's using Web Browsers
"""
=== Added File Zope3/lib/python/Zope/Publisher/Browser/IBrowserView.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""
$Id: IBrowserView.py,v 1.1.2.1 2002/05/29 15:09:53 jim Exp $
"""
from Zope.ComponentArchitecture.IView import IView
from IBrowserPresentation import IBrowserPresentation
class IBrowserView(IBrowserPresentation, IView):
"Browser View"
=== Zope3/lib/python/Zope/Publisher/Browser/BrowserRequest.py 1.1.4.12 => 1.1.4.12.10.1 ===
# requests when the effective and actual URLs differ.
- # _viewtype is overridden from the BaseRequest
+ # _presentation_type is overridden from the BaseRequest
# to implement IBrowserPublisher
- _viewtype = IBrowserPublisher
+ _presentation_type = IBrowserPublisher
@@ -579,4 +579,4 @@
L1.sort()
return ', '.join(
map(lambda item: "%s: %s" % (item[0], repr(item[1])), L1))
-
\ No newline at end of file
+
=== Zope3/lib/python/Zope/Publisher/Browser/metaConfigure.py 1.1.2.16 => 1.1.2.16.8.1 ===
#
##############################################################################
-from Zope.ComponentArchitecture.metaConfigure import handler
-from Zope.Configuration.Action import Action
-from IBrowserPublisher import IBrowserPublisher
+from Zope.ComponentArchitecture.metaConfigure \
+ import \
+ view as _view,\
+ defaultView as _defaultView, \
+ skin as _skin, \
+ resource as _resource
-def defaultView(_context, name, factory, for_=None, layer=''):
- if for_ is not None:
- for_ = _context.resolve(for_)
- factory = map(_context.resolve, factory.split())
+def defaultView(_context, **__kw):
+ return _defaultView(_context,
+ type='Zope.Publisher.Browser.IBrowserPublisher.',
+ **__kw)
- return [
- Action(
- discriminator = ('view', for_, name, IBrowserPublisher, layer),
- callable = handler,
- args = ('Views', 'provideView', for_, name, IBrowserPublisher, factory, layer),
- ),
- Action(
- discriminator = ('defaultViewName', for_, name, IBrowserPublisher),
- callable = handler,
- args = ('Views', 'setDefaultViewName', for_, IBrowserPublisher, name),
- )
- ]
-
-def view(_context, name, factory, for_=None, layer=''):
- if for_ is not None:
- for_ = _context.resolve(for_)
- factory = map(_context.resolve, factory.split())
-
- return [
- Action(
- discriminator = ('view', for_, name, IBrowserPublisher, layer),
- callable = handler,
- args = ('Views', 'provideView', for_, name, IBrowserPublisher, factory, layer),
- )
- ]
+def view(_context, **__kw):
+ return _view(_context,
+ type='Zope.Publisher.Browser.IBrowserPublisher.',
+ **__kw)
-def skin(_context, name, layers):
- layers = [layer.strip() for layer in layers.split(',')]
- return [
- Action(
- discriminator = ('skin', name, IBrowserPublisher),
- callable = handler,
- args = ('Skins', 'defineSkin', name, IBrowserPublisher, layers),
- )
- ]
+def skin(_context, **__kw):
+ return _skin(_context,
+ type='Zope.Publisher.Browser.IBrowserPublisher.',
+ **__kw)
-def resource(_context, component, name, layer=''):
- type = IBrowserPublisher
- component = _context.resolve(component)
- return [
- Action(
- discriminator = ('resource', name, type, layer),
- callable = handler,
- args = ('Resources', 'provideResource', name, type, component, layer),
- )
- ]
+def resource(_context, **__kw):
+ return _resource(_context,
+ type='Zope.Publisher.Browser.IBrowserPublisher.',
+ **__kw)