Commit cf2042ee authored by Andreas Jung's avatar Andreas Jung

replaced string module calls by string methods

parent 8f12e4a1
......@@ -15,7 +15,6 @@ API documentation help topics
"""
import types
import string
import HelpTopic
from Globals import DTMLFile, Persistent
......@@ -59,12 +58,12 @@ class APIHelpTopic(HelpTopic.HelpTopic):
# try to get title from first non-blank line
# of module docstring
if not self.title:
lines=string.split(self.doc,'\n')
lines=self.doc.split('\n')
while 1:
line=string.strip(lines[0])
line=lines[0].strip()
if line:
# get rid of anything after a colon in the line
self.title=string.split(line, ':')[0]
self.title=line.split(':')[0]
break
lines.pop(0)
if not lines:
......@@ -140,7 +139,7 @@ class APIDoc(Persistent):
if hasattr(klass,'__extends__'):
self.extends=[]
for base in klass.__extends__:
names=string.split(base, '.')
names=base.split( '.')
url="%s/Help/%s.py#%s" % (names[0], names[1], names[2])
self.extends.append((names[2], url))
......@@ -255,20 +254,20 @@ def trim_doc_string(text):
Trims a doc string to make it format
correctly with structured text.
"""
text=string.strip(text)
text=string.replace(text, '\r\n', '\n')
lines=string.split(text, '\n')
text=text.strip()
text=text.replace( '\r\n', '\n')
lines=text.split('\n')
nlines=[lines[0]]
if len(lines) > 1:
min_indent=None
for line in lines[1:]:
if not line:
continue
indent=len(line) - len(string.lstrip(line))
indent=len(line) - len(line.lstrip())
if indent < min_indent or min_indent is None:
min_indent=indent
for line in lines[1:]:
nlines.append(line[min_indent:])
return string.join(nlines, '\n')
return '\n'.join(nlines)
......@@ -18,7 +18,6 @@ from Globals import Persistent, HTML, DTMLFile, ImageFile
from OFS.DTMLDocument import DTMLDocument
from OFS.PropertyManager import PropertyManager
import os.path
import string
import Globals
class HelpTopicBase:
......@@ -71,7 +70,7 @@ class HelpTopicBase:
def url(self):
"URL for indexing purposes"
return string.join(self.getPhysicalPath(), '/')
return '/'.join(self.getPhysicalPath())
# Private indexing methods
# ------------------------
......
......@@ -12,12 +12,12 @@
##############################################################################
"""Help system support module"""
__version__='$Revision: 1.10 $'[11:-2]
__version__='$Revision: 1.11 $'[11:-2]
import Globals, Acquisition
import StructuredText.StructuredText
import sys, os, string, re
import sys, os, re
stx_class=StructuredText.StructuredText.HTML
......@@ -70,11 +70,11 @@ class object(Acquisition.Implicit):
def get_docstring_html(self):
doc=self.get_docstring()
if string.find(doc, '\n\n') > -1:
doc=string.split(doc, '\n\n')
if doc.find('\n\n') > -1:
doc=doc.split('\n\n')
if len(doc) > 1:
doc[1]=string.strip(doc[1])
doc=string.join(doc, '\n\n')
doc[1]=doc[1].strip()
doc='\n\n'.join(doc)
return str(stx_class(doc))
......@@ -233,7 +233,7 @@ class methodobject(object):
if hasattr(func, '__doc__'):
doc=func.__doc__
if not doc: doc=''
doc=string.strip(doc)
doc=doc.strip()
if hasattr(func, 'func_code'):
if hasattr(func.func_code, 'co_varnames'):
return doc
......@@ -268,14 +268,14 @@ class methodobject(object):
if method: args=args[1:]
if name=='__call__':
name='Call Operation'
return '%s(%s)' % (name, string.join(args,', '))
return '%s(%s)' % (name, ', '.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)
doc=doc.strip()
mo=sig_match(doc)
if mo is not None:
return doc[:mo.end(0)]
......
......@@ -12,10 +12,10 @@
##############################################################################
"""Object Reference implementation"""
__version__='$Revision: 1.8 $'[11:-2]
__version__='$Revision: 1.9 $'[11:-2]
import sys, os, string, Globals, Acquisition
import sys, os, Globals, Acquisition
from HelpUtil import HelpBase, classobject
from HelpUtil import is_class, is_module
from Globals import DTMLFile
......
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