[Zope3-checkins]
CVS: Zope3/src/zope/products/externaleditor/browser
- __init__.py:1.2
Sidnei da Silva
sidnei at x3ng.com.br
Fri Jan 30 17:43:50 EST 2004
Update of /cvs-repository/Zope3/src/zope/products/externaleditor/browser
In directory cvs.zope.org:/tmp/cvs-serv24348/browser
Modified Files:
__init__.py
Log Message:
A bit more work into it, and declare File externally editable
=== Zope3/src/zope/products/externaleditor/browser/__init__.py 1.1 => 1.2 ===
--- Zope3/src/zope/products/externaleditor/browser/__init__.py:1.1 Fri Jan 30 17:20:53 2004
+++ Zope3/src/zope/products/externaleditor/browser/__init__.py Fri Jan 30 17:43:49 2004
@@ -17,6 +17,7 @@
from zope.app.publisher.browser import BrowserView
from zope.app.interfaces.file import IReadFile, IWriteFile
from zope.app.content import queryContentType
+from zope.security.proxy import trustedRemoveSecurityProxy
class ExternalEditor(BrowserView):
@@ -30,12 +31,18 @@
r.append('url:%s' % url)
adapted = zapi.getAdapter(context, IReadFile)
- r.append('content_type:%s' % adapted.contentType)
+ if hasattr(adapted, 'contentType'):
+ # XXX Although IReadFile declares contentType,
+ # the default adapter for File doesn't seem
+ # to provide it.
+ r.append('content_type:%s' % adapted.contentType)
# XXX There's no such thing as a meta_type
# in Zope3, so we try to get as far as we can
# using IContentType, which is a marker interface
- meta_type = queryContentType(context)
+ # XXX Had to use trustedRemoveSecurityProxy because
+ # I was getting I was getting unauthorized on __iro__
+ meta_type = queryContentType(trustedRemoveSecurityProxy(context))
if meta_type:
r.append('meta_type:%s' % meta_type.__name__)
More information about the Zope3-Checkins
mailing list