[Zope-Checkins] CVS: Zope/lib/python/HelpSys - APIHelpTopic.py:1.15 HelpSys.py:1.24 HelpTopic.py:1.17 HelpUtil.py:1.12 ObjectRef.py:1.10 __init__.py:1.6
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 17:34:42 -0400
Update of /cvs-repository/Zope/lib/python/HelpSys
In directory cvs.zope.org:/tmp/cvs-serv13875
Modified Files:
APIHelpTopic.py HelpSys.py HelpTopic.py HelpUtil.py
ObjectRef.py __init__.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/HelpSys/APIHelpTopic.py 1.14 => 1.15 ===
--- Zope/lib/python/HelpSys/APIHelpTopic.py:1.14 Thu Feb 7 12:54:12 2002
+++ Zope/lib/python/HelpSys/APIHelpTopic.py Wed Aug 14 17:34:42 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""
API documentation help topics
@@ -33,7 +33,7 @@
isAPIHelpTopic=1
funcs=() # for backward compatibility
-
+
def __init__(self, id, title, file):
self.id=id
self.title=title
@@ -81,7 +81,7 @@
text="%s %s" % (text, api.SearchableText())
return text
-
+
class APIDoc(Persistent):
"""
Describes an API.
@@ -110,7 +110,7 @@
# constructor information
## if hasattr(klass, '__constructor__'):
## self.constructor=MethodDoc(klass.__constructor__)
-
+
# Get info on methods and attributes, ignore special items
self.attributes=[]
self.methods=[]
@@ -125,14 +125,14 @@
# Creates an APIDoc instance given a python class.
# the class describes the API; it contains
# methods, arguments and doc strings.
- #
+ #
# The name of the API is deduced from the name
# of the class.
#
# The base APIs are deduced from the __extends__
# attribute.
-
- self.name=klass.__name__
+
+ self.name=klass.__name__
self.doc=trim_doc_string(klass.__doc__)
# inheritence information
@@ -146,7 +146,7 @@
# constructor information
if hasattr(klass, '__constructor__'):
self.constructor=MethodDoc(klass.__constructor__)
-
+
# Get info on methods and attributes, ignore special items
self.attributes=[]
self.methods=[]
@@ -156,7 +156,7 @@
self.methods.append(MethodDoc(v, 0))
else:
self.attributes.append(AttributeDoc(k, v))
-
+
def SearchableText(self):
"""
The full text of the API, for indexing purposes.
@@ -167,15 +167,15 @@
for method in self.methods:
text="%s %s %s" % (text, method.name, method.doc)
return text
-
+
view=DTMLFile('dtml/APIView', globals())
-
-
+
+
class AttributeDoc(Persistent):
"""
Describes an attribute of an API.
"""
-
+
def __init__(self, name, value):
self.name=name
self.value=value
@@ -186,16 +186,16 @@
class MethodDoc(Persistent):
"""
Describes a method of an API.
-
- required - a sequence of required arguments
+
+ required - a sequence of required arguments
optional - a sequence of tuples (name, default value)
varargs - the name of the variable argument or None
kwargs - the name of the kw argument or None
"""
-
+
varargs=None
kwargs=None
-
+
def __init__(self, func, isInterface=0):
if isInterface:
self._createFromInterfaceMethod(func)
@@ -221,7 +221,7 @@
self.name=func.__name__
self.doc=trim_doc_string(func.__doc__)
-
+
# figure out the method arguments
# mostly stolen from pythondoc
CO_VARARGS = 4
@@ -265,9 +265,7 @@
continue
indent=len(line) - len(line.lstrip())
if indent < min_indent or min_indent is None:
- min_indent=indent
+ min_indent=indent
for line in lines[1:]:
nlines.append(line[min_indent:])
return '\n'.join(nlines)
-
-
=== Zope/lib/python/HelpSys/HelpSys.py 1.23 => 1.24 ===
--- Zope/lib/python/HelpSys/HelpSys.py:1.23 Mon Jun 10 16:20:43 2002
+++ Zope/lib/python/HelpSys/HelpSys.py Wed Aug 14 17:34:42 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import Acquisition
@@ -24,7 +24,7 @@
class HelpSys(Acquisition.Implicit, ObjectManager, Item, Persistent):
"""
Zope Help System
-
+
Provides browsing and searching of Zope Product Help.
"""
meta_type='Help System'
@@ -70,10 +70,10 @@
results=[]
for ph in self.helpValues():
results.append(apply(getattr(ph, '__call__'), (REQUEST,) , kw))
- return LazyCat(results)
-
+ return LazyCat(results)
+
searchResults=__call__
-
+
index_html=DTMLFile('dtml/frame', globals())
menu=DTMLFile('dtml/menu', globals())
search=DTMLFile('dtml/search', globals())
@@ -146,7 +146,7 @@
self.id=self.title=id
self.objs=objs
self.simple=simple
-
+
def tpValues(self):
values=[]
if self.simple:
@@ -169,7 +169,7 @@
values=[]
for topic in v:
values=values + list(topic.tpValues())
- results.append(TreeCollection(k, values))
+ results.append(TreeCollection(k, values))
results.sort(lambda x, y: cmp(x.id, y.id))
return results
@@ -180,7 +180,7 @@
class ProductHelp(Acquisition.Implicit, ObjectManager, Item, Persistent):
"""
Manages a collection of Help Topics for a given Product.
-
+
Provides searching services to HelpSystem.
"""
@@ -188,7 +188,7 @@
icon='p_/ProductHelp_icon'
lastRegistered=None
-
+
meta_types=({'name':'Help Topic',
'action':'addTopicForm',
'permission':'Add Documents, Images, and Files'},
@@ -202,7 +202,7 @@
__ac_permissions__=(
('Add Documents, Images, and Files', ('addTopicForm', 'addTopic')),
)
-
+
def __init__(self, id='Help', title=''):
self.id=id
self.title=title
@@ -275,7 +275,7 @@
if zpttopics:
topics = topics + [TreeCollection(' ZPT Reference', zpttopics)]
return topics
-
+
def all_meta_types(self):
f=lambda x: x['name'] in ('Image', 'File')
return filter(f, Products.meta_types) + self.meta_types
=== Zope/lib/python/HelpSys/HelpTopic.py 1.16 => 1.17 ===
--- Zope/lib/python/HelpSys/HelpTopic.py:1.16 Thu Feb 7 12:54:12 2002
+++ Zope/lib/python/HelpSys/HelpTopic.py Wed Aug 14 17:34:42 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import Acquisition
@@ -40,7 +40,7 @@
for m in self.permission_settings():
perms.append(m['name'])
return perms
-
+
permissions_values=ComputedAttribute(_permissions_values, 1)
categories_values=(
@@ -60,7 +60,7 @@
if user.has_permission(perm, self):
return 1
return 0
-
+
# Indexable methods
# -----------------
@@ -74,7 +74,7 @@
# Private indexing methods
# ------------------------
-
+
def manage_afterAdd(self, item, container):
self.index_object()
@@ -106,7 +106,7 @@
"""
Abstract base class for Help Topics
"""
-
+
meta_type='Help Topic'
icon='p_/HelpTopic_icon'
_v_last_read = 0
@@ -155,7 +155,7 @@
def SearchableText(self):
return '%s %s' % (self.title, self.read())
-
+
default_topic_content="""\
<dtml-var standard_html_header>
@@ -178,12 +178,12 @@
self.permissions=permissions
if categories is not None:
self.categories=categories
-
+
def SearchableText(self):
"The full text of the Help Topic, for indexing purposes"
return '%s %s' % (self.title, self.index_html.read())
-
+
class TextTopic(HelpTopic):
"""
A basic Help Topic. Holds a text file.
@@ -199,7 +199,7 @@
self.permissions=permissions
if categories is not None:
self.categories=categories
-
+
def __call__(self, REQUEST=None):
"View the Help Topic"
self._check_for_update()
@@ -209,13 +209,13 @@
"The full text of the Help Topic, for indexing purposes"
return '%s %s' % (self.title, self.obj)
-
+
class STXTopic(TextTopic):
"""
A structured-text topic. Holds a HTMLFile object.
"""
index_html = None
-
+
def __call__(self, REQUEST=None):
""" View the STX Help Topic """
self._check_for_update()
@@ -245,14 +245,13 @@
if permissions is not None:
self.permissions=permissions
if categories is not None:
- self.categories=categories
-
+ self.categories=categories
+
def index_html(self, REQUEST, RESPONSE):
"View the Help Topic"
self._check_for_update()
return self.image.index_html(REQUEST, RESPONSE)
-
+
def SearchableText(self):
"The full text of the Help Topic, for indexing purposes"
return ''
-
=== Zope/lib/python/HelpSys/HelpUtil.py 1.11 => 1.12 ===
--- Zope/lib/python/HelpSys/HelpUtil.py:1.11 Thu Feb 7 12:54:12 2002
+++ Zope/lib/python/HelpSys/HelpUtil.py Wed Aug 14 17:34:42 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Help system support module"""
@@ -75,7 +75,7 @@
if len(doc) > 1:
doc[1]=doc[1].strip()
doc='\n\n'.join(doc)
-
+
return str(stx_class(doc))
def version(self):
@@ -113,12 +113,12 @@
except:
t, v = sys.exc_info()[:2]
return '%s %s' % (t, v)
-
+
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()
@@ -144,7 +144,7 @@
for name in keys:
ob=dict[name]
if is_method(ob) and _chMethod(name, ob):
- methods.append(methodobject(name, ob, self))
+ methods.append(methodobject(name, ob, self))
return methods
def get_method_dict(self, dict=None):
@@ -280,7 +280,7 @@
if mo is not None:
return doc[:mo.end(0)]
return '%s()' % name
-
+
def get_signature(self):
try: return self.get_signaturex()
@@ -327,7 +327,7 @@
## 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()
@@ -350,14 +350,14 @@
## 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()
@@ -418,10 +418,3 @@
if name[0]=='_':
return 0
return 1
-
-
-
-
-
-
-
=== Zope/lib/python/HelpSys/ObjectRef.py 1.9 => 1.10 ===
--- Zope/lib/python/HelpSys/ObjectRef.py:1.9 Thu Feb 7 12:54:12 2002
+++ Zope/lib/python/HelpSys/ObjectRef.py Wed Aug 14 17:34:42 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Object Reference implementation"""
@@ -38,7 +38,7 @@
def hs_url(self):
return quote(self._obj_.meta_type)
-
+
hs_title=hs_id
def __getattr__(self, name):
@@ -58,7 +58,7 @@
if rdict.has_key(fname):
fn=rdict[fname]
fn.permission=pname
- mdict[fname]=fn
+ mdict[fname]=fn
keys=mdict.keys()
keys.sort()
for key in keys:
@@ -69,7 +69,7 @@
if hasattr(fn._obj_, '__class__') and \
fn._obj_.__class__.__doc__ is doc:
continue
-
+
mlist.append(mdict[key])
del rdict
del mdict
@@ -79,7 +79,7 @@
def hs_objectvalues(self):
return []
-
+
class ObjectRef(HelpBase):
""" """
@@ -94,7 +94,7 @@
hs_id ='ObjectRef'
hs_title='Object Reference'
hs_url =hs_id
-
+
def hs_deferred__init__(self):
# This is necessary because we want to wait until all
# products have been installed (imported).
@@ -140,4 +140,3 @@
def __getitem__(self, key):
return self.__dict__[key].__of__(self)
-
=== Zope/lib/python/HelpSys/__init__.py 1.5 => 1.6 ===
--- Zope/lib/python/HelpSys/__init__.py:1.5 Wed Nov 28 10:50:56 2001
+++ Zope/lib/python/HelpSys/__init__.py Wed Aug 14 17:34:42 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
# backward compatibility