B web/tests back to green stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 11 Aug 2009 17:51:48 +0200
branchstable
changeset 2780 ad1dfc3855b0
parent 2776 2dd05edb2f33
child 2781 4e1ad9d6a3e7
B web/tests back to green
web/test/unittest_urlrewrite.py
web/test/unittest_viewselector.py
web/views/autoform.py
web/views/startup.py
--- a/web/test/unittest_urlrewrite.py	Tue Aug 11 17:19:05 2009 +0200
+++ b/web/test/unittest_urlrewrite.py	Tue Aug 11 17:51:48 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:19:05 2009 +0200
+++ b/web/test/unittest_viewselector.py	Tue Aug 11 17:51:48 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:19:05 2009 +0200
+++ b/web/views/autoform.py	Tue Aug 11 17:51:48 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:19:05 2009 +0200
+++ b/web/views/startup.py	Tue Aug 11 17:51:48 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')