[Checkins] SVN: grokui.introspector/trunk/src/grokui/introspector/co Basic view for content.

Lennart Regebro regebro at gmail.com
Mon Jul 21 13:39:06 EDT 2008


Log message for revision 88655:
  Basic view for content.
  

Changed:
  U   grokui.introspector/trunk/src/grokui/introspector/code.py
  U   grokui.introspector/trunk/src/grokui/introspector/code_templates/objectinfoview.pt
  A   grokui.introspector/trunk/src/grokui/introspector/content.py
  A   grokui.introspector/trunk/src/grokui/introspector/content_templates/
  A   grokui.introspector/trunk/src/grokui/introspector/content_templates/inspect.pt

-=-
Modified: grokui.introspector/trunk/src/grokui/introspector/code.py
===================================================================
--- grokui.introspector/trunk/src/grokui/introspector/code.py	2008-07-21 17:36:08 UTC (rev 88654)
+++ grokui.introspector/trunk/src/grokui/introspector/code.py	2008-07-21 17:39:06 UTC (rev 88655)
@@ -32,7 +32,10 @@
     grok.name('index.html')
 
     def update(self, *args, **kw):
-        self.dotted_name = dotted_name_url(self.context.dotted_name)
+        self.dotted_name = dotted_name_url(self.context.getDottedName())
+        
+    def getType(self):
+        return self.context.getType().__name__
 
 class ModuleInfoView(ObjectInfoView):
     grok.context(IModuleInfo)
@@ -51,7 +54,7 @@
         result = []
         for name in files:
             dotnum = name.count('.')
-            url = dotted_name_url(self.context.dotted_name + '.' + name,
+            url = dotted_name_url(self.context.getDottedName() + '.' + name,
                                   preserve_last = dotnum)
             url = url.split('.', dotnum*2)[-1]
             result.append(dict(name=name, url=url))
@@ -61,7 +64,7 @@
     """Traverse object infos.
     """
     def traverse(self, path, *args, **kw):
-        dotted_name = '.'.join([self.context.dotted_name, path])
+        dotted_name = '.'.join([self.context.getDottedName(), path])
         provider = getUtility(IObjectDescriptionProvider)
         try:
             description = provider.getDescription(dotted_name=dotted_name)

Modified: grokui.introspector/trunk/src/grokui/introspector/code_templates/objectinfoview.pt
===================================================================
--- grokui.introspector/trunk/src/grokui/introspector/code_templates/objectinfoview.pt	2008-07-21 17:36:08 UTC (rev 88654)
+++ grokui.introspector/trunk/src/grokui/introspector/code_templates/objectinfoview.pt	2008-07-21 17:39:06 UTC (rev 88655)
@@ -1,8 +1,32 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html metal:use-macro="context/@@master/macros/page">
-  <div metal:fill-slot="main">
-    <div tal:content="python: context, dir(context)">context</div>
-    <div tal:content="python: context.obj">context</div>
-  </div>
-</html>
+<table>
+  <tr>
+    <td>Type:</td>
+    <td tal:content="view/getType"/>
+  </tr>
+  <tr>
+    <td>Class:</td>
+    <td tal:content="context/getDottedName"/>
+  </tr>
+  <tr>
+    <td>File:</td>
+    <td tal:content="context/getFile"/>
+  </tr>
+</table>
+
+<h3>Attributes</h3>
+<table>
+  <tr tal:repeat="attribute context/getAttributes">
+    <td>Name:</td>
+    <td tal:content="attribute/id"/>
+    <td>Value:</td>
+    <td tal:content="nocall: attribute/value"/>
+  </tr>
+</table>
+
+<h3>Methods</h3>
+<table>
+  <tr tal:repeat="attribute context/getMethods">
+    <td>Name:</td>
+    <td tal:content="attribute/id"/>
+  </tr>
+</table>

Added: grokui.introspector/trunk/src/grokui/introspector/content.py
===================================================================
--- grokui.introspector/trunk/src/grokui/introspector/content.py	                        (rev 0)
+++ grokui.introspector/trunk/src/grokui/introspector/content.py	2008-07-21 17:39:06 UTC (rev 88655)
@@ -0,0 +1,21 @@
+import grok
+from zope import interface
+
+from zope.introspector.interfaces import IObjectInfo
+
+class Inspect(grok.View):
+    grok.context(interface.Interface)
+    
+    _objectinfo = None
+    
+    def getObjectInfo(self):
+        if self._objectinfo is None:
+            self._objectinfo = IObjectInfo(self.context)
+        return self._objectinfo
+
+    def getTypeName(self):
+        type = self.getObjectInfo().getType()
+        return type.__module__ + '.' + type.__name__
+        
+    def getTypeInspectURL(self):
+        return ""
\ No newline at end of file


Property changes on: grokui.introspector/trunk/src/grokui/introspector/content.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: grokui.introspector/trunk/src/grokui/introspector/content_templates/inspect.pt
===================================================================
--- grokui.introspector/trunk/src/grokui/introspector/content_templates/inspect.pt	                        (rev 0)
+++ grokui.introspector/trunk/src/grokui/introspector/content_templates/inspect.pt	2008-07-21 17:39:06 UTC (rev 88655)
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html metal:use-macro="context/@@master/macros/page">
+  <div metal:fill-slot="main" tal:define="objectinfo view/getObjectInfo">
+    <h1>Content browser</h1>
+
+    <h2>Content</h2>
+    Here should be sub objects (if any)
+
+    <h2>Object Info</h2>
+    <span tal:content="structure objectinfo/@@index.html"/>
+
+  </div>
+</html>


Property changes on: grokui.introspector/trunk/src/grokui/introspector/content_templates/inspect.pt
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list