[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser - FileView.py:1.1.2.5 browser.zcml:1.1.2.4
Jim Fulton
jim@zope.com
Fri, 7 Jun 2002 10:41:39 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/OFS/Content/File/Views/Browser
Modified Files:
Tag: Zope-3x-branch
FileView.py browser.zcml
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals):
- RenameAllowToRequire
- GroupClassRelatedDirectivesInClassDirective
- ViewInterfaceAndSimplification
- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes
- TwoArgumentViewConstructors
- ImplementsInZCML
- SimpleViewCreationInZCML
- RemoveGetView
- ReplaceProtectWithAllow
- ViewMethodsAsViews
- MergeProtectionAndComponentDefinitions
There were also various security fixes resulting of better integration
of security with components.
=== Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/FileView.py 1.1.2.4 => 1.1.2.5 ===
"""
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
+from Zope.Publisher.Browser.BrowserView import BrowserView
-class FileView(AttributePublisher):
+class FileView(BrowserView):
- __implements__ = AttributePublisher.__implements__
-
- def __init__( self, zptpage ):
- self._zptpage = zptpage
-
-
- def index(self, REQUEST=None):
+ def __call__(self):
"""Call the File"""
- if REQUEST is not None:
- REQUEST.getResponse().setHeader('Content-Type',
- self.getContext().getContentType())
- REQUEST.getResponse().setHeader('Content-Length',
- self.getContext().getSize())
-
- return self.getContext().getData()
-
+ request = self.request
+ if request is not None:
+ request.getResponse().setHeader('Content-Type',
+ self.context.getContentType())
+ request.getResponse().setHeader('Content-Length',
+ self.context.getSize())
- def getContext( self ):
- return self._zptpage
-
+ return self.context.getData()
=== Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/browser.zcml 1.1.2.3 => 1.1.2.4 ===
<!-- File View Directives -->
- <browser:defaultView name="view"
- for="Zope.App.OFS.Content.File.IFile."
- factory=".FileView." />
-
- <security:protectClass
- class=".FileView."
- permission_id="Zope.View" names="index" />
-
- <browser:view name="edit"
- for="Zope.App.OFS.Content.File.IFile."
- factory=".FileEdit." />
-
- <security:protectClass
- class=".FileEdit."
- permission_id="Zope.View" names="index, action" />
-
+ <browser:defaultView
+ name="view"
+ for="Zope.App.OFS.Content.File.IFile."
+ permission="Zope.View"
+ factory=".FileView." />
+
+ <browser:view
+ name="edit"
+ for="Zope.App.OFS.Content.File.IFile."
+ permission="Zope.View"
+ factory=".FileEdit.">
+
+ <browser:page name="editForm.html" attribute="index" />
+ <browser:page name="edit.html" attribute="action" />
+ </browser:view>
<!-- Registering all the field views for the browser -->
- <browser:view name="DataFieldView"
- for="Zope.App.OFS.Content.File.IFile."
- factory="Zope.App.OFS.Content.File.FileFields.DataField.
- Zope.App.Formulator.Widgets.Browser.TextAreaWidget." />
-
- <browser:view name="ContentTypeFieldView"
- for="Zope.App.OFS.Content.File.IFile."
- factory="Zope.App.OFS.Content.File.FileFields.ContentTypeField.
- Zope.App.Formulator.Widgets.Browser.TextWidget." />
+ <browser:view
+ name="DataFieldView"
+ for="Zope.App.OFS.Content.File.IFile."
+ factory="Zope.App.OFS.Content.File.FileFields.DataField.
+ Zope.App.Formulator.Widgets.Browser.TextAreaWidget." />
+
+ <browser:view
+ name="ContentTypeFieldView"
+ for="Zope.App.OFS.Content.File.IFile."
+ factory="Zope.App.OFS.Content.File.FileFields.ContentTypeField.
+ Zope.App.Formulator.Widgets.Browser.TextWidget." />
</zopeConfigure>