backport stable branch
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 11 Aug 2009 18:41:39 +0200
changeset 2783 493f527aed1e
parent 2779 1ba89b590d0c (current diff)
parent 2781 4e1ad9d6a3e7 (diff)
child 2785 34dfdbefcfd1
backport stable branch
server/session.py
web/test/unittest_urlrewrite.py
web/test/unittest_viewselector.py
--- a/server/session.py	Tue Aug 11 17:28:18 2009 +0200
+++ b/server/session.py	Tue Aug 11 18:41:39 2009 +0200
@@ -114,8 +114,9 @@
         if rcache is not None:
             rset, entities = rcache
             rset.rows.append([targeteid])
-            if isinstance(rset.description, list): # else description not set
-                rset.description.append([self.describe(targeteid)[0]])
+            if not isinstance(rset.description, list): # else description not set
+                rset.description = list(rset.description)
+            rset.description.append([self.describe(targeteid)[0]])
             rset.rowcount += 1
             targetentity = self.entity_from_eid(targeteid)
             entities.append(targetentity)
--- a/web/test/unittest_urlrewrite.py	Tue Aug 11 17:28:18 2009 +0200
+++ b/web/test/unittest_urlrewrite.py	Tue Aug 11 18:41:39 2009 +0200
@@ -29,6 +29,8 @@
         self.assertListEquals(rules, [
             ('foo' , dict(rql='Foo F')),
             ('/index' , dict(vid='index2')),
+            ('/_', dict(vid='manage')),
+            ('/_registry', dict(vid='registry')),
             ('/schema', dict(vid='schema')),
             ('/myprefs', dict(vid='propertiesform')),
             ('/siteconfig', dict(vid='systempropertiesform')),
--- a/web/test/unittest_viewselector.py	Tue Aug 11 17:28:18 2009 +0200
+++ b/web/test/unittest_viewselector.py	Tue Aug 11 18:41:39 2009 +0200
@@ -74,6 +74,7 @@
                               ('manage', startup.ManageView),
                               ('owl', owl.OWLView),
                               ('propertiesform', cwproperties.CWPropertiesForm),
+                              ('registry', startup.RegistryView),
                               ('schema', schema.SchemaView),
                               ('systempropertiesform', cwproperties.SystemCWPropertiesForm)])
 
--- a/web/views/autoform.py	Tue Aug 11 17:28:18 2009 +0200
+++ b/web/views/autoform.py	Tue Aug 11 18:41:39 2009 +0200
@@ -25,6 +25,8 @@
     * rtags (rcategories, rfields, rwidgets, inlined, rpermissions)
     * various standard form parameters
 
+    XXX s/rtags/uicfg/ ?
+
     You can also easily customise it by adding/removing fields in
     AutomaticEntityForm instances.
     """
--- a/web/views/startup.py	Tue Aug 11 17:28:18 2009 +0200
+++ b/web/views/startup.py	Tue Aug 11 18:41:39 2009 +0200
@@ -160,16 +160,21 @@
 class RegistryView(StartupView):
     id = 'registry'
     title = _('registry')
-    __select__ = match_user_groups('managers')
+    __select__ = StartupView.__select__ & match_user_groups('managers')
 
     def call(self, **kwargs):
         """The default view representing the instance's management"""
         self.w(u'<h1>%s</h1>' % _("Registry's content"))
         keys = sorted(self.vreg)
-        self.w(u'<p>%s</p>' % ' - '.join('<a href="/_registry#%s">%s</a>' % (key, key) for key in keys))
+        self.w(u'<p>%s</p>\n' % ' - '.join('<a href="/_registry#%s">%s</a>' % (key, key) for key in keys))
         for key in keys:
-            self.w(u'<h2><a name="%s">%s</a></h2><table>' % (key,key))
-            for key, value in sorted(self.vreg[key].items()):
-                self.w(u'<tr><td>%s</td><td>%s</td></tr>' % (key, xml_escape(repr(value))))
-            self.w(u'</table>')
+            self.w(u'<h2><a name="%s">%s</a></h2>' % (key,key))
+            items = self.vreg[key].items()
+            if items:
+                self.w(u'<table><tbody>')
+                for key, value in sorted(items):
+                    self.w(u'<tr><td>%s</td><td>%s</td></tr>' % (key, xml_escape(repr(value))))
+                self.w(u'</tbody></table>\n')
+            else:
+                self.w(u'<p>Empty</p>\n')