[gen] Added field appyclass.breadcrumb, allowing to show/hide the breadcrumb when displaying instances of this class; added field appyclass.resultMode, allowing to choose between 'list' or 'grid' mode (previously, only list mode was enabled) when showing instances of this class as a result of some query.

This commit is contained in:
Gaetan Delannay 2013-03-09 16:06:12 +01:00
parent 46f5b8e464
commit c5ec54f0e5
4 changed files with 182 additions and 129 deletions

View file

@ -1606,7 +1606,12 @@ class BaseMixin:
if parent.meta_type not in ('Folder', 'Temporary Folder'): return parent
def getBreadCrumb(self):
'''Gets breadcrumb info about this object and its parents.'''
'''Gets breadcrumb info about this object and its parents (if it must
be shown).'''
# Return an empty breadcrumb if it must not be shown.
klass = self.getClass()
if hasattr(klass, 'breadcrumb') and not klass.breadcrumb: return ()
# Compute the breadcrumb
res = [{'url': self.absolute_url(),
'title': self.getFieldValue('title', layoutType='view')}]
parent = self.getParent()
@ -1746,7 +1751,8 @@ class BaseMixin:
appyType = self.getAppyType(name)
else:
appyType = self.getAppyType(name.split('_img_')[0])
if not appyType.isShowable(self, 'view'):
if (not appyType.isShowable(self, 'view')) and \
(not appyType.isShowable(self, 'result')):
from zExceptions import NotFound
raise NotFound()
theFile = getattr(self.aq_base, name, None)