[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - viewmeta.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Tue, 24 Dec 2002 01:54:28 -0500
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv17821
Modified Files:
Tag: NameGeddon-branch
viewmeta.py
Log Message:
- fix broken import
- minor cleanup, normalize whitespace
=== Zope3/src/zope/app/publisher/browser/viewmeta.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/publisher/browser/viewmeta.py:1.1.2.1 Mon Dec 23 14:32:02 2002
+++ Zope3/src/zope/app/publisher/browser/viewmeta.py Tue Dec 24 01:54:27 2002
@@ -2,14 +2,14 @@
#
# 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.
-#
+#
##############################################################################
"""Browser configuration code
@@ -32,12 +32,13 @@
from zope.app.component.metaconfigure import handler
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-from Zope.App.PageTemplate import ViewPageTemplateFile
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.publisher.browser.resourcemeta import resource
from zope.proxy.context import ContextMethod
+
class view(resource):
__class_implements__ = INonEmptyDirective
@@ -55,7 +56,6 @@
if class_ and factory:
raise ConfigurationError("Can't specify a class and a factory")
-
factory = factory or class_
if template:
@@ -73,7 +73,7 @@
if for_ is not None:
for_ = _context.resolve(for_)
self.for_ = for_
-
+
resource.__init__(self, _context, factory, name, layer,
permission, allowed_interface, allowed_attributes)
@@ -84,13 +84,11 @@
def page(self, _context, name, attribute=None, permission=None,
layer=None, template=None):
-
if self.template:
raise ConfigurationError(
"Can't use page or defaultPage subdirectives for simple "
"template views")
-
if self.name:
# Named view with pages.
@@ -98,7 +96,7 @@
raise ConfigurationError(
"Can't specify a separate layer for pages of named "
"templates.")
-
+
if template is not None:
template = _context.path(template)
@@ -140,13 +138,10 @@
callable = handler,
args = ('Views','setDefaultViewName', self.for_, self.type, name),
)]
-
- def _factory(self, _context, factory):
+ def _factory(self, _context, factory):
if self.template:
-
-
if factory:
factory = map(_context.resolve, factory.strip().split())
bases = (factory[-1], )
@@ -156,12 +151,11 @@
)
factory[-1] = klass
return factory
-
+
return [SimpleViewClass(
str(_context.path(self.template)),
used_for = self.for_
)]
-
else:
return map(_context.resolve, factory.strip().split())
@@ -173,9 +167,7 @@
self.for_, name, self.type, factory, layer)
def _pageFactory(self, factory, attribute, permission):
-
- factory = factory[:]
-
+ factory = factory[:]
if permission:
if permission == 'Zope.Public':
permission = CheckerPublic
@@ -185,20 +177,15 @@
permission=permission):
return Proxy(getattr(factory(context, request), attribute),
NamesChecker(__call__ = permission))
-
else:
-
def pageView(context, request,
factory=factory[-1], attribute=attribute):
return getattr(factory(context, request), attribute)
-
factory[-1] = pageView
-
return factory
def _proxyFactory(self, factory, checker):
-
- factory = factory[:]
+ factory = factory[:]
def proxyView(context, request,
factory=factory[-1], checker=checker):
@@ -221,7 +208,7 @@
# OK, we have named pages on a named view.
# We'll replace the original class with a new subclass that
- # can traverse to the necessary pages.
+ # can traverse to the necessary pages.
require = {}
@@ -263,7 +250,7 @@
permission_for_browser_publisher = CheckerPublic
for name in IBrowserPublisher.names(all=1):
require[name] = permission_for_browser_publisher
-
+
return super(view, self).__call__(require=require)
@@ -314,6 +301,3 @@
]
return actions
-
-
-