Commit c6c3623c authored by 's avatar

Added deferred__init__, bug and formatting fixes.

parent d61daf3c
"""Help system and documentation support"""
__version__='$Revision: 1.1 $'[11:-2]
__version__='$Revision: 1.2 $'[11:-2]
import sys, os, string, ts_regex
import Globals, Acquisition
from HelpUtil import classobject, methodobject, is_class, is_module
from App.Dialogs import MessageDialog
import Globals, Acquisition, StructuredText
from HelpUtil import classobject, is_class, is_module
from ImageFile import ImageFile
from StructuredText import HTML
from Globals import HTMLFile
......@@ -61,11 +59,14 @@ class ObjectItem(classobject):
class ObjectRef(Acquisition.Implicit):
"""Object reference"""
__names__=None
__roles__=None
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={}
for k, v in sys.modules.items():
if v is not None and k != '__builtins__':
......@@ -74,19 +75,23 @@ class ObjectRef(Acquisition.Implicit):
keys.sort()
for key in keys:
setattr(self, key, dict[key])
self._ids_=keys
self.__names__=keys
objectValues__roles__=None
def objectValues(self):
if self.__names__ is None:
self.deferred__init__()
items=[]
for id in self._ids_:
for id in self.__names__:
items.append(getattr(self, id))
return items
def search_mod(self, mod, dict):
hidden=('Control Panel', 'Principia Draft', 'simple item')
for k, v in mod.__dict__.items():
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)
if is_module(v) and hasattr(v, '__path__'):
dict=self.search_mod(v, dict)
......
"""Help system and documentation support"""
__version__='$Revision: 1.1 $'[11:-2]
__version__='$Revision: 1.2 $'[11:-2]
import Globals, Acquisition
import StructuredText.StructuredText
import sys, os, string, ts_regex
from StructuredText import HTML
stx_class=StructuredText.StructuredText.HTML
class object(Acquisition.Implicit):
......@@ -41,6 +42,16 @@ class object(Acquisition.Implicit):
return doc
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):
if hasattr(self._obj_, '__version__'):
return self._obj_.__version__
......@@ -177,6 +188,7 @@ pre_match=ts_regex.compile('[A-Za-z0-9_]*([^)]*)[ -]*').match
sig_match=ts_regex.compile('[A-Za-z0-9_]*([^)]*)').match
class methodobject(object):
def get_class(self):
return self._obp_
......
......@@ -6,34 +6,25 @@ ZOPE Help
</head>
<body bgcolor="#ffffff" link="#000099" vlink="#555555">
<h2>ZOPE Help</h2>
<h2>Zope Help</h2>
<p>
The ZOPE online help system provides programming documentation
as well as links to in-depth product guides, mailing lists and
other resources.
The Zope online help system provides links to in-depth product guides,
programming references and other resources.
</p>
<h3>General Documentation</h3>
<p>
General documentation includes documentation for the use and
management of built-in and add-on products, as well as an
extensive DTML manual.
General documentation for the use and management of built-in and
add-on products, as well as an extensive DTML manual are available
on the Zope website at
<a href="http://www.zope.org" target="_top">http://www.zope.org</a>.
</p>
<ul>
<li> <a href="">
ZOPE Manager's Guide
</a>
<li> <a href="">
DTML manual
</a>
</ul>
<h3>Programming References</h3>
<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
and Folders. Other references will be added soon.
</p>
......@@ -47,12 +38,10 @@ and Folders. Other references will be added soon.
<h3>Other Resources</h3>
<p>
Online resources include the <a href="http://www.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 email to <a href="mailto:zope-request@zope.org">
zope-request@zope.org</a> and including the word &quot;subscribe&quot;
in the subject line.
One of the best resources available is the <a href="mailto:zope@zope.org">
Zope mailing list</a>. You can subscribe to the mailing list by sending an
email to <a href="mailto:zope-request@zope.org">zope-request@zope.org</a>
and including the word &quot;subscribe&quot; in the subject line.
</p>
......
......@@ -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>
<p>
<code>
<!--#var get_docstring-->
<!--#var get_docstring_html-->
</code>
</p>
<h3><!--#var meta_type--> methods</h3>
......@@ -56,14 +55,15 @@ Object Reference
</code>
</dt>
<dd><code>
<!--#if permission-->
<!--#if permission-->
<strong>Permission:</strong> <!--#var permission--><br><br>
<!--#endif-->
<!--#endif-->
<!--#if get_docstring--><!--#var get_docstring--><!--#
else-->No documentation for this method<!--#
endif-->
<br>
<!--#if get_docstring_html-->
<!--#var get_docstring_html-->
<!--#else-->
<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>
</code>
</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