AdaptedList -> SameETypeList
*NO BW COMPAT*, benefit from cw 3.6 releasing of folder,file and blog
which use it to get update at the same time.
CMHN and PEGASE will need update (but won't go to 3.6 without update,
so seem fine).
--- a/web/test/unittest_views_baseviews.py Mon Feb 08 12:03:03 2010 +0100
+++ b/web/test/unittest_views_baseviews.py Mon Feb 08 12:05:56 2010 +0100
@@ -47,9 +47,9 @@
def test_more_than_one_entity_same_type(self):
req = self.request()
rset = self.execute('Any X WHERE X is CWUser')
- self.assertEquals(vid_from_rset(req, rset, self.schema), 'adaptedlist')
+ self.assertEquals(vid_from_rset(req, rset, self.schema), 'sameetypelist')
rset = self.execute('Any X, L WHERE X login L')
- self.assertEquals(vid_from_rset(req, rset, self.schema), 'adaptedlist')
+ self.assertEquals(vid_from_rset(req, rset, self.schema), 'sameetypelist')
def test_more_than_one_entity_diff_type(self):
req = self.request()
--- a/web/test/unittest_viewselector.py Mon Feb 08 12:03:03 2010 +0100
+++ b/web/test/unittest_viewselector.py Mon Feb 08 12:05:56 2010 +0100
@@ -89,8 +89,7 @@
req = self.request()
rset = req.execute('CWGroup X WHERE X name "managers"')
self.assertListEqual(self.pviews(req, rset),
- [('adaptedlist', baseviews.AdaptedListView),
- ('csvexport', csvexport.CSVRsetView),
+ [('csvexport', csvexport.CSVRsetView),
('ecsvexport', csvexport.CSVEntityView),
('editable-table', tableview.EditableTableView),
('filetree', treeview.FileTreeView),
@@ -100,6 +99,7 @@
('primary', primary.PrimaryView),
('rsetxml', xmlrss.XMLRsetView),
('rss', xmlrss.RSSView),
+ ('sameetypelist', baseviews.SameETypeListView),
('secondary', baseviews.SecondaryView),
('security', management.SecurityManagementView),
('table', tableview.TableView),
@@ -113,8 +113,7 @@
req = self.request()
rset = req.execute('CWGroup X')
self.assertListEqual(self.pviews(req, rset),
- [('adaptedlist', baseviews.AdaptedListView),
- ('csvexport', csvexport.CSVRsetView),
+ [('csvexport', csvexport.CSVRsetView),
('ecsvexport', csvexport.CSVEntityView),
('editable-table', tableview.EditableTableView),
('filetree', treeview.FileTreeView),
@@ -124,6 +123,7 @@
('primary', primary.PrimaryView),
('rsetxml', xmlrss.XMLRsetView),
('rss', xmlrss.RSSView),
+ ('sameetypelist', baseviews.SameETypeListView),
('secondary', baseviews.SecondaryView),
('security', management.SecurityManagementView),
('table', tableview.TableView),
@@ -201,8 +201,7 @@
req = self.request()
rset = req.execute('CWUser X')
self.assertListEqual(self.pviews(req, rset),
- [('adaptedlist', baseviews.AdaptedListView),
- ('csvexport', csvexport.CSVRsetView),
+ [('csvexport', csvexport.CSVRsetView),
('ecsvexport', csvexport.CSVEntityView),
('editable-table', tableview.EditableTableView),
('filetree', treeview.FileTreeView),
@@ -213,6 +212,7 @@
('primary', primary.PrimaryView),
('rsetxml', xmlrss.XMLRsetView),
('rss', xmlrss.RSSView),
+ ('sameetypelist', baseviews.SameETypeListView),
('secondary', baseviews.SecondaryView),
('security', management.SecurityManagementView),
('table', tableview.TableView),
--- a/web/views/__init__.py Mon Feb 08 12:03:03 2010 +0100
+++ b/web/views/__init__.py Mon Feb 08 12:05:56 2010 +0100
@@ -82,7 +82,7 @@
return 'primary'
return 'outofcontext-search'
if len(rset.column_types(0)) == 1:
- return 'adaptedlist'
+ return 'sameetypelist'
return 'list'
return 'table'
--- a/web/views/baseviews.py Mon Feb 08 12:03:03 2010 +0100
+++ b/web/views/baseviews.py Mon Feb 08 12:05:56 2010 +0100
@@ -297,11 +297,13 @@
redirect_vid = 'incontext'
-class AdaptedListView(EntityView):
- """list of entities of the same type"""
- __regid__ = 'adaptedlist'
+class SameETypeListView(EntityView):
+ """list of entities of the same type, when asked explicitly for adapted list
+ view (for instance, display gallery if only images)
+ """
+ __regid__ = 'sameetypelist'
__select__ = EntityView.__select__ & one_etype_rset()
- item_vid = 'adaptedlistitem'
+ item_vid = 'sameetypelistitem'
@property
def title(self):
@@ -312,18 +314,19 @@
"""display a list of entities by calling their <item_vid> view"""
if not 'vtitle' in self._cw.form:
self.w(u'<h1>%s</h1>' % self.title)
- super(AdaptedListView, self).call(**kwargs)
+ super(SameETypeListView, self).call(**kwargs)
def cell_call(self, row, col=0, vid=None, **kwargs):
self.wview(self.item_vid, self.cw_rset, row=row, col=col, vid=vid, **kwargs)
-class AdaptedListItemView(EntityView):
- __regid__ = 'adaptedlistitem'
+class SameETypeListItemView(EntityView):
+ __regid__ = 'sameetypelistitem'
def cell_call(self, row, col, **kwargs):
self.wview('listitem', self.cw_rset, row=row, col=col, **kwargs)
+
class CSVView(SimpleListView):
__regid__ = 'csv'
redirect_vid = 'incontext'