.
+ """
__regid__ = 'simplelist'
redirect_vid = 'incontext'
@@ -330,8 +420,13 @@
class SameETypeListView(EntityView):
- """list of entities of the same type, when asked explicitly for same etype list
- view (for instance, display gallery if only images)
+ """:__regid__: *sameetypelist*
+
+ This view displays a list of entities of the same type, in HTML section
+ ('
') and call the view `sameetypelistitem` for each entity of the
+ result set. It's designed to get a more adapted global list when displayed
+ entities are all of the same type (for instance, display gallery if there
+ are only images entities).
"""
__regid__ = 'sameetypelist'
__select__ = EntityView.__select__ & one_etype_rset()
@@ -361,6 +456,11 @@
class CSVView(SimpleListView):
+ """:__regid__: *csv*
+
+ This view displays each entity in a coma separated list. It is NOT related
+ to the well-known text file format.
+ """
__regid__ = 'csv'
redirect_vid = 'incontext'
@@ -377,12 +477,48 @@
self.w(u", ")
+# XXX to be documented views ###################################################
+
+class MetaDataView(EntityView):
+ """paragraph view of some metadata"""
+ __regid__ = 'metadata'
+ show_eid = True
+
+ def cell_call(self, row, col):
+ _ = self._cw._
+ entity = self.cw_rset.get_entity(row, col)
+ self.w(u'
')
+ if self.show_eid:
+ self.w(u'%s #%s - ' % (entity.dc_type(), entity.eid))
+ if entity.modification_date != entity.creation_date:
+ self.w(u'%s ' % _('latest update on'))
+ self.w(u'%s, '
+ % self._cw.format_date(entity.modification_date))
+ # entities from external source may not have a creation date (eg ldap)
+ if entity.creation_date:
+ self.w(u'%s ' % _('created on'))
+ self.w(u'%s'
+ % self._cw.format_date(entity.creation_date))
+ if entity.creator:
+ if entity.creation_date:
+ self.w(u' %s ' % _('by'))
+ else:
+ self.w(u' %s ' % _('created_by'))
+ self.w(u'%s' % entity.creator.name())
+ meta = entity.cw_metainformation()
+ if meta['source']['uri'] != 'system':
+ self.w(u' (%s' % _('cw_source'))
+ self.w(u' %s)' % meta['source']['uri'])
+ self.w(u'
')
+
+
class TreeItemView(ListItemView):
__regid__ = 'treeitem'
def cell_call(self, row, col):
self.wview('incontext', self.cw_rset, row=row, col=col)
+
class TextSearchResultView(EntityView):
"""this view is used to display full-text search
@@ -405,7 +541,7 @@
value = xml_escape(entity.printable_value(attr, format='text/plain').lower())
except TransformError, ex:
continue
- except:
+ except Exception:
continue
if searched in value:
contexts = []
@@ -425,26 +561,6 @@
self.wview('oneline', self.cw_rset, row=row, col=col)
-# XXX bw compat
-
-from logilab.common.deprecation import class_moved
-
-try:
- from cubicweb.web.views.tableview import TableView
- TableView = class_moved(TableView)
-except ImportError:
- pass # gae has no tableview module (yet)
-
-from cubicweb.web.views import boxes, xmlrss, primary
-PrimaryView = class_moved(primary.PrimaryView)
-SideBoxView = class_moved(boxes.SideBoxView)
-XmlView = class_moved(xmlrss.XMLView)
-XmlItemView = class_moved(xmlrss.XMLItemView)
-XmlRsetView = class_moved(xmlrss.XMLRsetView)
-RssView = class_moved(xmlrss.RSSView)
-RssItemView = class_moved(xmlrss.RSSItemView)
-
-
class GroupByView(EntityView):
"""grouped view of a result set. The `group_key` method return the group
key of an entities (a string or tuple of string).
@@ -452,7 +568,7 @@
For each group, display a link to entities of this group by generating url
like
/ or //.
"""
- __abstrack__ = True
+ __abstract__ = True
__select__ = EntityView.__select__ & match_kwargs('basepath')
entity_attribute = None
reversed = False
@@ -550,3 +666,29 @@
url = self.index_url(basepath, key, vtitle=vtitle)
title = self._cw._('archive for %(author)s') % {'author': key}
return tags.a(label, href=url, title=title)
+
+
+# bw compat ####################################################################
+
+from logilab.common.deprecation import class_moved, class_deprecated
+
+from cubicweb.web.views import boxes, xmlrss, primary, tableview
+PrimaryView = class_moved(primary.PrimaryView)
+SideBoxView = class_moved(boxes.SideBoxView)
+XmlView = class_moved(xmlrss.XMLView)
+XmlItemView = class_moved(xmlrss.XMLItemView)
+XmlRsetView = class_moved(xmlrss.XMLRsetView)
+RssView = class_moved(xmlrss.RSSView)
+RssItemView = class_moved(xmlrss.RSSItemView)
+TableView = class_moved(tableview.TableView)
+
+
+class SecondaryView(EntityView):
+ __metaclass__ = class_deprecated
+ __deprecation_warning__ = '[3.9] the secondary view is deprecated, use one of oneline/incontext/outofcontext'
+ __regid__ = 'secondary'
+
+ def cell_call(self, row, col, **kwargs):
+ entity = self.cw_rset.get_entity(row, col)
+ self.w(u' ')
+ self.wview('oneline', self.cw_rset, row=row, col=col)