Commit c6c3623c authored by 's avatar

Added deferred__init__, bug and formatting fixes.

parent d61daf3c
"""Help system and documentation support""" """Help system and documentation support"""
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
import sys, os, string, ts_regex import sys, os, string, ts_regex
import Globals, Acquisition import Globals, Acquisition, StructuredText
from HelpUtil import classobject, methodobject, is_class, is_module from HelpUtil import classobject, is_class, is_module
from App.Dialogs import MessageDialog
from ImageFile import ImageFile from ImageFile import ImageFile
from StructuredText import HTML
from Globals import HTMLFile from Globals import HTMLFile
...@@ -61,11 +59,14 @@ class ObjectItem(classobject): ...@@ -61,11 +59,14 @@ class ObjectItem(classobject):
class ObjectRef(Acquisition.Implicit): class ObjectRef(Acquisition.Implicit):
"""Object reference""" """Object reference"""
__names__=None
__roles__=None __roles__=None
index_html=HTMLFile('objectref_index', globals()) index_html=HTMLFile('objectref_index', globals())
def __init__(self): def deferred__init__(self):
# This is necessary because we want to wait until all
# products have been installed (imported).
dict={} dict={}
for k, v in sys.modules.items(): for k, v in sys.modules.items():
if v is not None and k != '__builtins__': if v is not None and k != '__builtins__':
...@@ -74,19 +75,23 @@ class ObjectRef(Acquisition.Implicit): ...@@ -74,19 +75,23 @@ class ObjectRef(Acquisition.Implicit):
keys.sort() keys.sort()
for key in keys: for key in keys:
setattr(self, key, dict[key]) setattr(self, key, dict[key])
self._ids_=keys self.__names__=keys
objectValues__roles__=None objectValues__roles__=None
def objectValues(self): def objectValues(self):
if self.__names__ is None:
self.deferred__init__()
items=[] items=[]
for id in self._ids_: for id in self.__names__:
items.append(getattr(self, id)) items.append(getattr(self, id))
return items return items
def search_mod(self, mod, dict): def search_mod(self, mod, dict):
hidden=('Control Panel', 'Principia Draft', 'simple item')
for k, v in mod.__dict__.items(): for k, v in mod.__dict__.items():
if is_class(v) and hasattr(v, 'meta_type') and \ if is_class(v) and hasattr(v, 'meta_type') and \
hasattr(v, '__ac_permissions__'): hasattr(v, '__ac_permissions__') and \
(v.meta_type not in hidden):
dict[v.meta_type]=ObjectItem(k, v) dict[v.meta_type]=ObjectItem(k, v)
if is_module(v) and hasattr(v, '__path__'): if is_module(v) and hasattr(v, '__path__'):
dict=self.search_mod(v, dict) dict=self.search_mod(v, dict)
......
"""Help system and documentation support""" """Help system and documentation support"""
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
import Globals, Acquisition import Globals, Acquisition
import StructuredText.StructuredText
import sys, os, string, ts_regex import sys, os, string, ts_regex
from StructuredText import HTML
stx_class=StructuredText.StructuredText.HTML
class object(Acquisition.Implicit): class object(Acquisition.Implicit):
...@@ -41,6 +42,16 @@ class object(Acquisition.Implicit): ...@@ -41,6 +42,16 @@ class object(Acquisition.Implicit):
return doc return doc
return '' return ''
def get_docstring_html(self):
doc=self.get_docstring()
if string.find(doc, '\n\n') > -1:
doc=string.split(doc, '\n\n')
if len(doc) > 1:
doc[1]=string.strip(doc[1])
doc=string.join(doc, '\n\n')
return str(stx_class(doc))
def version(self): def version(self):
if hasattr(self._obj_, '__version__'): if hasattr(self._obj_, '__version__'):
return self._obj_.__version__ return self._obj_.__version__
...@@ -177,6 +188,7 @@ pre_match=ts_regex.compile('[A-Za-z0-9_]*([^)]*)[ -]*').match ...@@ -177,6 +188,7 @@ pre_match=ts_regex.compile('[A-Za-z0-9_]*([^)]*)[ -]*').match
sig_match=ts_regex.compile('[A-Za-z0-9_]*([^)]*)').match sig_match=ts_regex.compile('[A-Za-z0-9_]*([^)]*)').match
class methodobject(object): class methodobject(object):
def get_class(self): def get_class(self):
return self._obp_ return self._obp_
......
...@@ -6,34 +6,25 @@ ZOPE Help ...@@ -6,34 +6,25 @@ ZOPE Help
</head> </head>
<body bgcolor="#ffffff" link="#000099" vlink="#555555"> <body bgcolor="#ffffff" link="#000099" vlink="#555555">
<h2>ZOPE Help</h2> <h2>Zope Help</h2>
<p> <p>
The ZOPE online help system provides programming documentation The Zope online help system provides links to in-depth product guides,
as well as links to in-depth product guides, mailing lists and programming references and other resources.
other resources.
</p> </p>
<h3>General Documentation</h3> <h3>General Documentation</h3>
<p> <p>
General documentation includes documentation for the use and General documentation for the use and management of built-in and
management of built-in and add-on products, as well as an add-on products, as well as an extensive DTML manual are available
extensive DTML manual. on the Zope website at
<a href="http://www.zope.org" target="_top">http://www.zope.org</a>.
</p> </p>
<ul>
<li> <a href="">
ZOPE Manager's Guide
</a>
<li> <a href="">
DTML manual
</a>
</ul>
<h3>Programming References</h3> <h3>Programming References</h3>
<p> <p>
ZOPE provides an online object reference that documents the Zope provides an online object reference that documents the
services provided by high-level objects such as Documents services provided by high-level objects such as Documents
and Folders. Other references will be added soon. and Folders. Other references will be added soon.
</p> </p>
...@@ -47,12 +38,10 @@ and Folders. Other references will be added soon. ...@@ -47,12 +38,10 @@ and Folders. Other references will be added soon.
<h3>Other Resources</h3> <h3>Other Resources</h3>
<p> <p>
Online resources include the <a href="http://www.zope.org/"> One of the best resources available is the <a href="mailto:zope@zope.org">
ZOPE website</a> and the <a href="mailto:zope@zope.org"> Zope mailing list</a>. You can subscribe to the mailing list by sending an
ZOPE mailing list</a>. You can subscribe to the mailing email to <a href="mailto:zope-request@zope.org">zope-request@zope.org</a>
list by sending an email to <a href="mailto:zope-request@zope.org"> and including the word &quot;subscribe&quot; in the subject line.
zope-request@zope.org</a> and including the word &quot;subscribe&quot;
in the subject line.
</p> </p>
......
...@@ -14,11 +14,10 @@ Object Reference ...@@ -14,11 +14,10 @@ Object Reference
<h3><!--#if icon--><img src="<!--#var SCRIPT_NAME-->/<!--#var icon-->" height="16" width="16" alt=""><!--#endif--> <!--#var meta_type--></h3> <h3><!--#if icon--><img src="<!--#var SCRIPT_NAME-->/<!--#var icon-->" height="16" width="16" alt=""><!--#endif--> <!--#var meta_type--></h3>
<p>
<code> <code>
<!--#var get_docstring--> <!--#var get_docstring_html-->
</code> </code>
</p>
<h3><!--#var meta_type--> methods</h3> <h3><!--#var meta_type--> methods</h3>
...@@ -56,14 +55,15 @@ Object Reference ...@@ -56,14 +55,15 @@ Object Reference
</code> </code>
</dt> </dt>
<dd><code> <dd><code>
<!--#if permission--> <!--#if permission-->
<strong>Permission:</strong> <!--#var permission--><br><br> <strong>Permission:</strong> <!--#var permission--><br><br>
<!--#endif--> <!--#endif-->
<!--#if get_docstring--><!--#var get_docstring--><!--# <!--#if get_docstring_html-->
else-->No documentation for this method<!--# <!--#var get_docstring_html-->
endif--> <!--#else-->
<br> <p>No documentation for this method</p>
<!--#endif-->
<a href="#top"><img src="<!--#var SCRIPT_NAME-->/HelpSys/u_arrow" height="9" width="9" border="0" valign="bottom" alt=""> top</a><br><br> <a href="#top"><img src="<!--#var SCRIPT_NAME-->/HelpSys/u_arrow" height="9" width="9" border="0" valign="bottom" alt=""> top</a><br><br>
</code> </code>
</dd> </dd>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment