[Checkins] SVN: Sandbox/ulif/grok-adminui/src/grok/admin/ Added
DocGrok for Grok applications (still behaves like docgrok for
ordinary classes).
Uli Fouquet
uli at gnufix.de
Wed Jun 27 20:21:24 EDT 2007
Log message for revision 77160:
Added DocGrok for Grok applications (still behaves like docgrok for ordinary classes).
Changed:
U Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py
U Sandbox/ulif/grok-adminui/src/grok/admin/view.py
A Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/docgrokgrokapplicationview.pt
-=-
Modified: Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py
===================================================================
--- Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py 2007-06-28 00:00:18 UTC (rev 77159)
+++ Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py 2007-06-28 00:21:20 UTC (rev 77160)
@@ -16,6 +16,7 @@
import grok
import inspect
import grok.interfaces
+from grok.interfaces import IApplication
from martian.scan import is_package, ModuleInfo
from martian import InstanceGrokker, ModuleGrokker
@@ -71,6 +72,13 @@
return None
return DocGrokClass(dotted_path)
+def handle_grokapplication( dotted_path, ob=None):
+ if ob is None:
+ ob = resolve(dotted_path)
+ if not IApplication.implementedBy( ob ):
+ return None
+ return DocGrokGrokApplication(dotted_path)
+
# The docgroks registry.
#
# We register 'manually', because the handlers
@@ -82,6 +90,8 @@
'handler' : handle_package },
{ 'name' : 'interface',
'handler' : handle_interface },
+ { 'name' : 'grokapplication',
+ 'handler' : handle_grokapplication },
{ 'name' : 'class',
'handler' : handle_class } ]
@@ -485,3 +495,8 @@
if filename.endswith('o') or filename.endswith('c'):
filename = filename[:-1]
return filename
+
+class DocGrokGrokApplication(DocGrokClass):
+ """This doctor cares for Grok applications and components.
+ """
+ pass
Modified: Sandbox/ulif/grok-adminui/src/grok/admin/view.py
===================================================================
--- Sandbox/ulif/grok-adminui/src/grok/admin/view.py 2007-06-28 00:00:18 UTC (rev 77159)
+++ Sandbox/ulif/grok-adminui/src/grok/admin/view.py 2007-06-28 00:21:20 UTC (rev 77160)
@@ -1,6 +1,6 @@
import grok
from grok.admin.docgrok import DocGrok, DocGrokPackage, DocGrokModule, getThingsType
-from grok.admin.docgrok import DocGrokClass, DocGrokInterface
+from grok.admin.docgrok import DocGrokClass, DocGrokInterface, DocGrokGrokApplication
import zope.component
from zope.app.folder.interfaces import IRootFolder
@@ -277,3 +277,9 @@
class DocGrokInterfaceView(DocGrokClassView):
grok.context(DocGrokInterface)
grok.name( 'index' )
+
+class DocGrokGrokApplicationView(DocGrokClassView):
+ grok.context(DocGrokGrokApplication)
+ grok.name( 'index' )
+
+
Added: Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/docgrokgrokapplicationview.pt
===================================================================
--- Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/docgrokgrokapplicationview.pt (rev 0)
+++ Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/docgrokgrokapplicationview.pt 2007-06-28 00:21:20 UTC (rev 77160)
@@ -0,0 +1,206 @@
+<html metal:use-macro="view/app_root/@@macros/gaia-page">
+ <head>
+ <title>DocGrok page title</title>
+ </head>
+ <body>
+ <div metal:fill-slot="content">
+
+ <h1>
+ Class
+ <span class="docgrok-pathvalue">
+ <span class="docgrok-elemname1">
+ <span tal:replace="context/name">ClassName</span>
+ </span>
+ </span> in <span class="docgrok-pathvalue">
+ <span tal:repeat="part python: view.getPathParts()[:-1]"><a href=""
+ tal:attributes="href string:${view/root_url}${part/url}"
+ tal:content="part/name">part</a></span></span> (a Grok Application)
+ </h1>
+ <div class="docgrok-entry"
+ tal:content="structure python: view.getDoc(context.getDocString())">
+ Documentation string.
+ </div>
+ <div>
+ <h2>Paths</h2>
+
+ <div class="docgrok-entry">
+ <span class="docgrok-description1">Python path:</span>
+ <span class="docgrok-pathvalue"
+ tal:content="context/path">path.in.python</span>
+ <div class="docgrok-annotation2">
+ Use <span class="docgrok-pycode1">from <span tal:replace="context/module_path">path</span>
+ import <span tal:replace="context/name">path</span></span>
+ to use the functionality of this module in your application or component.
+ </div>
+ </div>
+
+ <div class="docgrok-entry">
+ <span class="docgrok-description1">Absolute file path: </span>
+ <span class="docgrok-pathvalue"
+ tal:content="context/getFilePath">/absolute/file/path</span>
+ <div class="docgrok-annotation2">
+ This is the file, wherein this class is defined.
+ </div>
+ </div>
+
+ </div>
+ <div>
+
+ <h2>Base Classes</h2>
+
+ <div class="docgrok-entry" tal:repeat="item view/getBases">
+ class
+ <span class="docgrok-pathvalue">
+ <a href=""
+ tal:attributes="href string:${view/root_url}/docgrok/${item/url}"
+ tal:content="item/name">
+ ClassName
+ </a>
+ </span>
+ in
+ <span class="docgrok-pathvalue">
+ <a href=""
+ tal:repeat="part item/path_parts"
+ tal:attributes="href string:${view/root_url}${part/url}">
+
+ <span tal:replace="part/name" />
+ </a>
+ </span>
+ <div class="docgrok-annotation2"
+ tal:condition="item/doc"
+ tal:content="structure item/doc">
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="not: item/doc">
+ Use <span class="docgrok-pycode1">from <span
+ tal:replace="item/path">x</span> import <span
+ tal:replace="item/name">y</span></span> to make the
+ functionality of this class available in your application
+ or component.
+ </div>
+ </div>
+
+ <h2>Interfaces</h2>
+
+ <div class="docgrok-entry" tal:repeat="item view/getInterfaces">
+ interface
+ <span class="docgrok-pathvalue">
+ <a href=""
+ tal:attributes="href string:${view/root_url}/docgrok/${item/url}"
+ tal:content="item/name">
+ ClassName
+ </a>
+ </span>
+ in
+ <span class="docgrok-pathvalue">
+ <a href=""
+ tal:repeat="part item/path_parts"
+ tal:attributes="href string:${view/root_url}${part/url}">
+
+ <span tal:replace="part/name" />
+ </a>
+ </span>
+ <div class="docgrok-annotation2"
+ tal:condition="item/doc"
+ tal:content="structure item/doc">
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="not: item/doc">
+ Use <span class="docgrok-pycode1">from <span
+ tal:replace="item/path">x</span> import <span
+ tal:replace="item/name">y</span></span> to make the
+ functionality of this class available in your application
+ or component.
+ </div>
+ </div>
+
+ <div tal:repeat="iface view/getInterfaces">
+ <div tal:content="python: str(iface)">asd</div>
+ </div>
+<!--
+ <h2>Functions:</h2>
+
+ <div class="docgrok-entry" tal:repeat="item view/getEntries">
+ <div tal:condition="item/isfunction">
+ <div class="docgrok-pathvalue">
+ function
+ <a href=""
+ tal:attributes="href
+ string:${view/root_url}/docgrok/${item/url}" >
+ <span tal:content="item/name">function_name</span><span tal:content="item/signature">(signature)</span>
+ </a>
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="item/doc"
+ tal:content="structure item/doc">
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="not: item/doc">
+ Use <span class="docgrok-pycode1">from <span
+ tal:replace="context/path">x</span> import <span
+ tal:replace="item/name">y</span></span> to make the
+ functionality of this class available in your application
+ or component.
+ </div>
+ </div>
+ </div>
+
+ <h2>Interfaces:</h2>
+
+ <div class="docgrok-entry" tal:repeat="item view/getEntries">
+ <div tal:condition="item/isinterface">
+ <div class="docgrok-pathvalue">
+ interface
+ <a href=""
+ tal:attributes="href string:${view/root_url}/docgrok/${item/url}"
+ tal:content="item/name">
+ InterfaceName
+ </a>
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="item/doc"
+ tal:content="structure item/doc">
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="not: item/doc">
+ Use <span class="docgrok-pycode1">from <span
+ tal:replace="context/path">x</span> import <span
+ tal:replace="item/name">y</span></span> to make this
+ interface definition available in your application
+ or component.
+ </div>
+ </div>
+ </div>
+
+ <h2>Classes:</h2>
+
+ <div class="docgrok-entry" tal:repeat="item view/getEntries">
+ <div tal:condition="item/isclass">
+ <div class="docgrok-pathvalue">
+ class
+ <a href=""
+ tal:attributes="href string:${view/root_url}/docgrok/${item/url}"
+ tal:content="item/name">
+ ClassName
+ </a>
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="item/doc"
+ tal:content="structure item/doc">
+ </div>
+ <div class="docgrok-annotation2"
+ tal:condition="not: item/doc">
+ Use <span class="docgrok-pycode1">from <span
+ tal:replace="context/path">x</span> import <span
+ tal:replace="item/name">y</span></span> to make the
+ functionality of this class available in your application
+ or component.
+ </div>
+ </div>
+ </div>
+-->
+ </div>
+
+ </div>
+ </body>
+</html>
More information about the Checkins
mailing list