Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
f46869dc
Commit
f46869dc
authored
Dec 01, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial
parent
bed4bfd8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
688 additions
and
0 deletions
+688
-0
lib/python/HelpSys/HelpSys.py
lib/python/HelpSys/HelpSys.py
+129
-0
lib/python/HelpSys/HelpUtil.py
lib/python/HelpSys/HelpUtil.py
+386
-0
lib/python/HelpSys/__init__.py
lib/python/HelpSys/__init__.py
+0
-0
lib/python/HelpSys/d_arrow.gif
lib/python/HelpSys/d_arrow.gif
+0
-0
lib/python/HelpSys/helpsys_index.dtml
lib/python/HelpSys/helpsys_index.dtml
+60
-0
lib/python/HelpSys/l_arrow.gif
lib/python/HelpSys/l_arrow.gif
+0
-0
lib/python/HelpSys/objectitem_index.dtml
lib/python/HelpSys/objectitem_index.dtml
+78
-0
lib/python/HelpSys/objectref_index.dtml
lib/python/HelpSys/objectref_index.dtml
+35
-0
lib/python/HelpSys/r_arrow.gif
lib/python/HelpSys/r_arrow.gif
+0
-0
lib/python/HelpSys/u_arrow.gif
lib/python/HelpSys/u_arrow.gif
+0
-0
No files found.
lib/python/HelpSys/HelpSys.py
0 → 100644
View file @
f46869dc
"""Help system and documentation support"""
__version__
=
'$Revision: 1.1 $'
[
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
from
ImageFile
import
ImageFile
from
StructuredText
import
HTML
from
Globals
import
HTMLFile
class
ObjectItem
(
classobject
):
"""Object type wrapper"""
index_html
=
HTMLFile
(
'objectitem_index'
,
globals
())
__roles__
=
None
def
__getattr__
(
self
,
name
):
if
name
in
(
'isDocTemp'
,
'__call__'
):
raise
AttributeError
,
name
return
getattr
(
self
.
__dict__
[
'_obj_'
],
name
)
def
get_method_list
(
self
):
rdict
=
classobject
.
get_method_dict
(
self
)
perms
=
self
.
__ac_permissions__
mdict
=
{}
mlist
=
[]
for
p
in
self
.
__ac_permissions__
:
pname
=
p
[
0
]
fnames
=
p
[
1
]
for
fname
in
fnames
:
if
rdict
.
has_key
(
fname
):
fn
=
rdict
[
fname
]
fn
.
permission
=
pname
mdict
[
fname
]
=
fn
keys
=
mdict
.
keys
()
keys
.
sort
()
for
key
in
keys
:
fn
=
mdict
[
key
]
if
not
hasattr
(
fn
.
_obj_
,
'__doc__'
):
continue
doc
=
fn
.
_obj_
.
__doc__
if
hasattr
(
fn
.
_obj_
,
'__class__'
)
and
\
fn
.
_obj_
.
__class__
.
__doc__
is
doc
:
continue
mlist
.
append
(
mdict
[
key
])
del
rdict
del
mdict
return
mlist
class
ObjectRef
(
Acquisition
.
Implicit
):
"""Object reference"""
__roles__
=
None
index_html
=
HTMLFile
(
'objectref_index'
,
globals
())
def
__init__
(
self
):
dict
=
{}
for
k
,
v
in
sys
.
modules
.
items
():
if
v
is
not
None
and
k
!=
'__builtins__'
:
dict
=
self
.
search_mod
(
v
,
dict
)
keys
=
dict
.
keys
()
keys
.
sort
()
for
key
in
keys
:
setattr
(
self
,
key
,
dict
[
key
])
self
.
_ids_
=
keys
objectValues__roles__
=
None
def
objectValues
(
self
):
items
=
[]
for
id
in
self
.
_ids_
:
items
.
append
(
getattr
(
self
,
id
))
return
items
def
search_mod
(
self
,
mod
,
dict
):
for
k
,
v
in
mod
.
__dict__
.
items
():
if
is_class
(
v
)
and
hasattr
(
v
,
'meta_type'
)
and
\
hasattr
(
v
,
'__ac_permissions__'
):
dict
[
v
.
meta_type
]
=
ObjectItem
(
k
,
v
)
if
is_module
(
v
)
and
hasattr
(
v
,
'__path__'
):
dict
=
self
.
search_mod
(
v
,
dict
)
return
dict
def
__getitem__
(
self
,
key
):
return
self
.
__dict__
[
key
].
__of__
(
self
)
def
tpId
(
self
):
return
'ObjectRef'
tpURL
=
tpId
def
tpValues
(
self
):
return
self
.
objectValues
()
def
__len__
(
self
):
return
1
class
HelpSys
(
Acquisition
.
Implicit
):
"""Help system root"""
__roles__
=
None
index_html
=
HTMLFile
(
'helpsys_index'
,
globals
())
u_arrow
=
ImageFile
(
'u_arrow.gif'
,
globals
())
d_arrow
=
ImageFile
(
'd_arrow.gif'
,
globals
())
r_arrow
=
ImageFile
(
'r_arrow.gif'
,
globals
())
l_arrow
=
ImageFile
(
'l_arrow.gif'
,
globals
())
ObjectRef
=
ObjectRef
()
def
__len__
(
self
):
return
1
lib/python/HelpSys/HelpUtil.py
0 → 100644
View file @
f46869dc
"""Help system and documentation support"""
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
import
Globals
,
Acquisition
import
sys
,
os
,
string
,
ts_regex
from
StructuredText
import
HTML
class
object
(
Acquisition
.
Implicit
):
def
__init__
(
self
,
name
,
ob
,
op
=
None
):
self
.
_name
=
name
self
.
_obj_
=
ob
self
.
_obp_
=
op
def
__getattr__
(
self
,
name
):
return
getattr
(
self
.
__dict__
[
'_obj_'
],
name
)
def
__len__
(
self
):
return
1
def
get_id
(
self
):
return
id
(
self
.
_obj_
)
def
get_name
(
self
):
return
self
.
_name
def
get_type
(
self
):
return
type
(
self
.
_obj_
).
__name__
def
get_value
(
self
):
return
self
.
_obj_
def
get_docstring
(
self
):
if
hasattr
(
self
.
_obj_
,
'__doc__'
):
doc
=
self
.
_obj_
.
__doc__
if
not
doc
:
doc
=
''
return
doc
return
''
def
version
(
self
):
if
hasattr
(
self
.
_obj_
,
'__version__'
):
return
self
.
_obj_
.
__version__
tpId
=
get_name
tpURL
=
get_name
__str__
=
get_name
class
moduleobject
(
object
):
def
get_file
(
self
):
if
hasattr
(
self
.
_obj_
,
'__file__'
):
return
self
.
_obj_
.
__file__
def
get_modules
(
self
):
data
=
[]
for
name
,
ob
in
self
.
_obj_
.
__dict__
.
items
():
if
is_module
(
ob
)
and
_chModule
(
name
,
ob
):
data
.
append
(
moduleobject
(
name
,
ob
,
self
))
return
data
def
get_classes
(
self
):
data
=
[]
for
name
,
ob
in
self
.
_obj_
.
__dict__
.
items
():
if
is_class
(
ob
)
and
_chClass
(
name
,
ob
):
data
.
append
(
classobject
(
name
,
ob
,
self
))
return
data
class
classobject
(
object
):
def
get_metatype
(
self
):
try
:
return
self
.
_obj_
.
meta_type
except
:
return
'%s %s'
%
(
`sys.exc_type`
,
`sys.exc_value`
)
def
get_module
(
self
):
if
hasattr
(
self
.
_obj_
,
'__module__'
):
module
=
sys
.
modules
[
self
.
_obj_
.
__module__
]
return
moduleobject
(
module
.
__name__
,
module
)
def
get_file
(
self
):
return
self
.
get_module
().
get_file
()
def
get_bases
(
self
):
bases
=
[]
if
hasattr
(
self
.
_obj_
,
'__bases__'
):
for
base
in
self
.
_obj_
.
__bases__
:
bases
.
append
(
classobject
(
base
.
__name__
,
base
))
return
bases
def
get_base_list
(
self
,
list
=
None
):
if
list
is
None
:
list
=
[]
list
.
append
(
self
)
for
base
in
self
.
get_bases
():
list
=
base
.
get_base_list
(
list
)
return
list
def
get_methods
(
self
):
keys
=
self
.
_obj_
.
__dict__
.
keys
()
dict
=
self
.
_obj_
.
__dict__
keys
.
sort
()
methods
=
[]
for
name
in
keys
:
ob
=
dict
[
name
]
if
is_method
(
ob
)
and
_chMethod
(
name
,
ob
):
methods
.
append
(
methodobject
(
name
,
ob
,
self
))
return
methods
def
get_method_dict
(
self
,
dict
=
None
):
if
dict
is
None
:
dict
=
{}
dup
=
dict
.
has_key
for
method
in
self
.
get_methods
():
name
=
method
.
get_name
()
if
not
dup
(
name
):
dict
[
name
]
=
method
for
base
in
self
.
get_bases
():
dict
=
base
.
get_method_dict
(
dict
)
return
dict
def
get_method_list
(
self
):
dict
=
self
.
get_method_dict
()
keys
=
dict
.
keys
()
keys
.
sort
()
list
=
[]
for
key
in
keys
:
list
.
append
(
dict
[
key
])
del
dict
return
list
## def obAttributes(self):
## # Return list of class attributes
## keys=self._obj_.__dict__.keys()
## dict=self._obj_.__dict__
## keys.sort()
## attrs=[]
## for name in keys:
## ob=dict[name]
## if _isAttribute(ob) and _chAttribute(name, ob):
## attrs.append(AttributeObject(name, ob, self))
## return attrs
## def obAttributeDict(self, dict=None):
## # Return dict of attrs in class and superclasses
## if dict is None:
## dict={}
## root=1
## else: root=0
## dup=dict.has_key
## for attr in self._obj_Attributes():
## name=attr.obName()
## if not dup(name):
## dict[name]=attr
## for base in self._obj_Bases():
## dict=base.obAttributeDict(dict)
## return dict
## def obAttributeList(self):
## # Return list of attrs in class and superclasses
## dict=self._obj_AttributeDict()
## keys=dict.keys()
## keys.sort()
## list=[]
## append=list.append
## for name in keys:
## append(dict[name])
## del dict
## return list
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_
def
get_module
(
self
):
return
self
.
get_class
().
get_module
()
def
get_file
(
self
):
return
self
.
get_module
().
get_file
()
def
get_docstring
(
self
):
func
=
self
.
_obj_
doc
=
''
if
hasattr
(
func
,
'im_func'
):
func
=
func
.
im_func
if
hasattr
(
func
,
'__doc__'
):
doc
=
func
.
__doc__
if
not
doc
:
doc
=
''
doc
=
string
.
strip
(
doc
)
if
hasattr
(
func
,
'func_code'
):
if
hasattr
(
func
.
func_code
,
'co_varnames'
):
return
doc
n
=
pre_match
(
doc
)
if
n
>
-
1
:
return
doc
[
n
:]
return
doc
def
get_signaturex
(
self
):
name
=
self
.
_name
func
=
self
.
_obj_
method
=
None
if
hasattr
(
func
,
'im_func'
):
method
=
1
func
=
func
.
im_func
# Normal functions
if
hasattr
(
func
,
'func_code'
):
if
hasattr
(
func
.
func_code
,
'co_varnames'
):
args
=
map
(
lambda
x
:
x
,
func
.
func_code
.
co_varnames
[:
func
.
func_code
.
co_argcount
])
ndefaults
=
func
.
func_defaults
ndefaults
=
ndefaults
and
len
(
ndefaults
)
or
0
if
'__ick__'
in
args
:
nick
=
len
(
args
)
-
args
.
index
(
'__ick__'
)
args
=
args
[:
-
nick
]
ndefaults
=
ndefaults
-
nick
if
ndefaults
>
0
:
args
[
-
ndefaults
]
=
'['
+
args
[
-
ndefaults
]
args
[
-
1
]
=
args
[
-
1
]
+
']'
if
method
:
args
=
args
[
1
:]
if
name
==
'__call__'
:
name
=
'Call Operation'
return
'%s(%s)'
%
(
name
,
string
.
join
(
args
,
', '
))
# Other functions - look for something that smells like
# a signature at the beginning of the docstring.
if
hasattr
(
func
,
'__doc__'
):
doc
=
func
.
__doc__
if
not
doc
:
doc
=
''
doc
=
string
.
strip
(
doc
)
n
=
sig_match
(
doc
)
if
n
>
-
1
:
return
doc
[:
n
]
return
'%s()'
%
name
def
get_signature
(
self
):
try
:
return
self
.
get_signaturex
()
except
:
return
'%s %s'
%
(
sys
.
exc_type
,
sys
.
exc_value
)
## class AttributeObject(_ob_):
## def obClass(self):
## return self.op
## def obModule(self):
## return self.obClass().obModule()
## def obFile(self):
## return self.obModule().obFile()
## class InstanceObject(_ob_):
## def obClass(self):
## # Return the class for this instance
## c=self._obj_.__class__
## return ClassObject(c.__name__, c)
## def obClassList(self):
## # Return list of all superclasses
## return self._obj_Class().obClassList()
## def obMethods(self):
## # Return list of instance methods
## keys=self._obj_.__dict__.keys()
## dict=self._obj_.__dict__
## keys.sort()
## methods=[]
## for name in keys:
## ob=dict[name]
## if _isMethod(ob) and _chMethod(name, ob):
## methods.append(MethodObject(name, ob))
## return methods
## def obMethodDict(self):
## # Return dict of instance and superclass methods
## dict=self._obj_Class().obMethodDict()
## for method in self._obj_Methods():
## dict[method.obName()]=method
## return dict
## def obMethodList(self):
## # Return list of instance and superclass methods
## dict=self._obj_MethodDict()
## keys=dict.keys()
## keys.sort()
## list=[]
## append=list.append
## for name in keys:
## append(dict[name])
## return list
## def obAttributes(self):
## # Return list of instance attributes
## keys=self._obj_.__dict__.keys()
## dict=self._obj_.__dict__
## keys.sort()
## attrs=[]
## for name in keys:
## ob=dict[name]
## if _isAttribute(ob) and _chAttribute(name, ob):
## attrs.append(AttributeObject(name, ob, self))
## return attrs
## def obAttributeDict(self):
## # Return dict of instance and superclass attributes
## dict=self._obj_Class().obAttributeDict()
## for attr in self._obj_Attributes():
## dict[attr.obName()]=attr
## return dict
## def obAttributeList(self):
## # Return list of instance and superclass attributes
## dict=self._obj_AttributeDict()
## keys=dict.keys()
## keys.sort()
## list=[]
## append=list.append
## for name in keys:
## append(dict[name])
## return list
_classtypes
=
(
type
(
Globals
.
HTML
),
type
(
Globals
.
Persistent
),
)
_methodtypes
=
(
type
([].
sort
),
type
(
Globals
.
default__class_init__
),
type
(
Globals
.
HTML
.
manage_edit
),
type
(
Globals
.
HTML
.
__changed__
),
type
(
Globals
.
MessageDialog
.
manage_edit
),
)
def
is_module
(
ob
):
return
type
(
ob
)
==
type
(
sys
)
def
is_class
(
ob
):
return
type
(
ob
)
in
_classtypes
def
is_method
(
ob
):
if
type
(
ob
)
in
_methodtypes
or
hasattr
(
ob
,
'func_code'
):
return
1
return
0
def
is_attribute
(
ob
):
return
not
is_method
(
ob
)
def
_chModule
(
name
,
ob
):
if
name
[
0
]
==
'_'
:
return
0
return
1
def
_chClass
(
name
,
ob
):
if
name
[
0
]
==
'_'
:
return
0
return
1
def
_chMethod
(
name
,
ob
):
if
name
[
0
]
==
'_'
:
return
0
return
1
def
_chAttribute
(
name
,
ob
):
if
name
[
0
]
==
'_'
:
return
0
return
1
lib/python/HelpSys/__init__.py
0 → 100644
View file @
f46869dc
lib/python/HelpSys/d_arrow.gif
0 → 100755
View file @
f46869dc
835 Bytes
lib/python/HelpSys/helpsys_index.dtml
0 → 100644
View file @
f46869dc
<html>
<head>
<title>
ZOPE Help
</title>
</head>
<body
bgcolor=
"#ffffff"
link=
"#000099"
vlink=
"#555555"
>
<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.
</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.
</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
services provided by high-level objects such as Documents
and Folders. Other references will be added soon.
</p>
<ul>
<li>
<a
href=
"<!--#var BASE1-->/HelpSys/ObjectRef/index_html"
>
Object Reference
</a>
</ul>
<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
"
subscribe
"
in the subject line.
</p>
</body>
</html>
lib/python/HelpSys/l_arrow.gif
0 → 100755
View file @
f46869dc
835 Bytes
lib/python/HelpSys/objectitem_index.dtml
0 → 100644
View file @
f46869dc
<html>
<head>
<title>
Object Reference
</title>
</head>
<body
bgcolor=
"#ffffff"
link=
"#000099"
vlink=
"#555555"
>
<a
name=
"top"
>
<h2><a
href=
"../index_html"
>
Object Reference
</a></h2>
<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-->
</code>
</p>
<h3>
<!--#var meta_type-->
methods
</h3>
<!--#call "REQUEST.set('cached_method_list', get_method_list())"-->
<!--#call "REQUEST.set('row_max', _.len(cached_method_list)/2)"-->
<!--#if "_.len(cached_method_list) % 2"-->
<!--#call "REQUEST.set('row_max', row_max+1)"-->
<!--#endif-->
<table
width=
"100%"
border=
"0"
>
<tr>
<td
align=
"left"
valign=
"top"
>
<code>
<!--#in "cached_method_list[:row_max]"-->
<a
href=
"#<!--#var get_name-->"
>
<!--#var get_name-->
</a><br>
<!--#endin-->
</code>
</td>
<td
align=
"left"
valign=
"top"
>
<code>
<!--#in "cached_method_list[row_max:]"-->
<a
href=
"#<!--#var get_name-->"
>
<!--#var get_name-->
</a><br>
<!--#endin-->
</code>
</td>
</tr>
</table>
<dl>
<!--#in cached_method_list-->
<dt><code>
<a
name=
"<!--#var get_name-->"
>
<strong>
<!--#var get_signature-->
</strong>
</code>
</dt>
<dd><code>
<!--#if permission-->
<strong>
Permission:
</strong>
<!--#var permission-->
<br><br>
<!--#endif-->
<!--#if get_docstring--><!--#var get_docstring--><!--#
else-->
No documentation for this method
<!--#
endif-->
<br>
<a
href=
"#top"
><img
src=
"u_arrow.gif"
height=
"9"
width=
"9"
border=
"0"
valign=
"bottom"
alt=
""
>
top
</a><br><br>
</code>
</dd>
<!--#endin-->
</dl>
<p>
<a
href=
"../index_html"
>
<img
src=
"<!--#var SCRIPT_NAME-->/HelpSys/l_arrow"
height=
"9"
width=
"9"
border=
"0"
valign=
"bottom"
alt=
""
>
Back to Object Reference
</a>
</p>
</body>
</html>
lib/python/HelpSys/objectref_index.dtml
0 → 100644
View file @
f46869dc
<html>
<head>
<title>
Object Reference
</title>
</head>
<body
bgcolor=
"#ffffff"
link=
"#000099"
vlink=
"#555555"
>
<h2>
Object Reference
</h2>
<p>
The object reference documents the interfaces of
objects which are built in to the system or have
been installed as add-on products. This reference
focuses on those object services useful in
<em>
DTML scripting
</em>
.
</p>
<ul>
<!--#in objectValues-->
<!--#with sequence-item-->
<li>
<a
href=
"<!--#var BASE1-->/HelpSys/ObjectRef/<!--#var
meta_type fmt=url-quote-->/index_html"
>
<!--#var meta_type-->
</a>
<!--#endwith-->
</li>
<!--#endin-->
</ul>
<p>
<a
href=
"../index_html"
>
<img
src=
"<!--#var SCRIPT_NAME-->/HelpSys/l_arrow"
height=
"9"
width=
"9"
border=
"0"
valign=
"bottom"
alt=
""
>
Back to Help
</a>
</p>
</body>
</html>
lib/python/HelpSys/r_arrow.gif
0 → 100755
View file @
f46869dc
835 Bytes
lib/python/HelpSys/u_arrow.gif
0 → 100755
View file @
f46869dc
836 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment