F [registry views] add _registry startup view
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 09 Aug 2009 15:40:46 +0200
changeset 2748 d2fcf19bfb34
parent 2746 cfcc7f6121d6
child 2751 5b0993df7c8a
F [registry views] add _registry startup view
common/mixins.py
web/views/startup.py
web/views/urlrewrite.py
--- a/common/mixins.py	Fri Aug 07 17:51:16 2009 +0200
+++ b/common/mixins.py	Sun Aug 09 15:40:46 2009 +0200
@@ -365,6 +365,7 @@
 
 class ProgressMixIn(object):
     """provide default implementations for IProgress interface methods"""
+    # This is an adapter isn't it ?
 
     @property
     def cost(self):
--- a/web/views/startup.py	Fri Aug 07 17:51:16 2009 +0200
+++ b/web/views/startup.py	Sun Aug 09 15:40:46 2009 +0200
@@ -156,3 +156,19 @@
     def display_folders(self):
         return 'Folder' in self.schema and self.req.execute('Any COUNT(X) WHERE X is Folder')[0][0]
 
+
+class RegistryView(StartupView):
+    id = 'registry'
+    title = _('registry')
+
+    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))
+        for key in keys:
+            self.w(u'<a name="%s"><h2>%s</h2></a><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>')
+
--- a/web/views/urlrewrite.py	Fri Aug 07 17:51:16 2009 +0200
+++ b/web/views/urlrewrite.py	Sun Aug 09 15:40:46 2009 +0200
@@ -70,6 +70,9 @@
     id = 'simple'
 
     rules = [
+        ('/_', dict(vid='manage')),
+        ('/_registry', dict(vid='registry')),
+#        (rgx('/_([^/]+?)/?'), dict(vid=r'\1')),
         ('/schema',  dict(vid='schema')),
         ('/index', dict(vid='index')),
         ('/myprefs', dict(vid='propertiesform')),