[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/
Merged r26700 and r26701 from trunk.
Garrett Smith
garrett at mojave-corp.com
Fri Jul 23 10:50:20 EDT 2004
Log message for revision 26703:
Merged r26700 and r26701 from trunk.
Changed:
U Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.pt
U Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py
A Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/
U Zope3/branches/ZopeX3-3.0/src/zope/app/dublincore/browser/configure.zcml
U Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py
-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.pt
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.pt 2004-07-23 14:11:13 UTC (rev 26702)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.pt 2004-07-23 14:50:20 UTC (rev 26703)
@@ -100,9 +100,8 @@
> </span>
</td>
- <td><span tal:attributes="size item/size/sizeForSorting"
- tal:content="item/size/sizeForDisplay"
- > </span></td>
+ <td><span tal:content="item/size/sizeForDisplay|nothing">
+ </span></td>
<td><span tal:define="created item/created|default"
tal:content="created"> </span></td>
<td><span tal:define="modified item/modified|default"
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py 2004-07-23 14:11:13 UTC (rev 26702)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py 2004-07-23 14:50:20 UTC (rev 26703)
@@ -16,7 +16,8 @@
$Id$
"""
-from zope.exceptions import NotFoundError
+from zope.exceptions import NotFoundError, Unauthorized
+from zope.security import checkPermission
from zope.app import zapi
from zope.app.size.interfaces import ISized
@@ -157,21 +158,22 @@
dc = IZopeDublinCore(obj, None)
if dc is not None:
- info['retitleable'] = id != retitle_id
+ info['retitleable'] = checkPermission(
+ 'zope.app.dublincore.change', dc) and id != retitle_id
info['plaintitle'] = 0
- title = dc.title
+ title = self.safe_getattr(dc, 'title', None)
if title:
info['title'] = title
formatter = self.request.locale.dates.getFormatter(
'dateTime', 'short')
- created = dc.created
+ created = self.safe_getattr(dc, 'created', None)
if created is not None:
info['created'] = formatter.format(created)
- modified = dc.modified
+ modified = self.safe_getattr(dc, 'modified', None)
if modified is not None:
info['modified'] = formatter.format(modified)
else:
@@ -184,6 +186,13 @@
info['size'] = sized_adapter
return info
+ def safe_getattr(self, obj, attr, default):
+ """Attempts to read the attr, returning default if Unauthorized."""
+ try:
+ return getattr(obj, attr, default)
+ except Unauthorized:
+ return default
+
def renameObjects(self):
"""Given a sequence of tuples of old, new ids we rename"""
request = self.request
Copied: Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests (from rev 26702, Zope3/trunk/src/zope/app/container/ftests)
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/dublincore/browser/configure.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/dublincore/browser/configure.zcml 2004-07-23 14:11:13 UTC (rev 26702)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/dublincore/browser/configure.zcml 2004-07-23 14:50:20 UTC (rev 26703)
@@ -4,7 +4,7 @@
<pages
for="zope.app.annotation.interfaces.IAnnotatable"
- permission="zope.ManageContent"
+ permission="zope.app.dublincore.change"
class=".metadataedit.MetaDataEdit">
<page name="EditMetaData.html" template="edit.pt"
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py 2004-07-23 14:11:13 UTC (rev 26702)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py 2004-07-23 14:50:20 UTC (rev 26703)
@@ -19,6 +19,7 @@
from zope.app.size.interfaces import ISized
from zope.app import zapi
from zope.interface import implements
+from zope.exceptions import Unauthorized
from zope.tales.interfaces import ITALESFunctionNamespace
from interfaces import IZopeTalesAPI
@@ -64,7 +65,10 @@
return zapi.name(self.context)
def title_or_name(self):
- return getattr(self, 'title', '') or zapi.name(self.context)
+ try:
+ return getattr(self, 'title', '') or zapi.name(self.context)
+ except Unauthorized:
+ return zapi.name(self.context)
def size(self):
a = ISized(self.context, None)
More information about the Zope3-Checkins
mailing list