[Zope-Checkins] CVS: Zope/lib/python/Products/ZopeTutorial - TutorialTopic.py:1.12 __init__.py:1.11
Andreas Jung
andreas@digicool.com
Mon, 11 Mar 2002 10:49:21 -0500
Update of /cvs-repository/Zope/lib/python/Products/ZopeTutorial
In directory cvs.zope.org:/tmp/cvs-serv19595/ZopeTutorial
Modified Files:
TutorialTopic.py __init__.py
Log Message:
string module free zone
=== Zope/lib/python/Products/ZopeTutorial/TutorialTopic.py 1.11 => 1.12 ===
import DocumentTemplate
import StructuredText
-import string, re
+import re
pre_pat=re.compile(r'<PRE>(.+?)</PRE>', re.IGNORECASE|re.DOTALL)
@@ -45,7 +45,7 @@
if REQUEST.has_key('tutorialExamplesURL'):
url=REQUEST['tutorialExamplesURL']
base=REQUEST['BASE1']
- if string.index(url, base) == 0:
+ if url.index(base) == 0:
url=url[len(base):]
try:
self.getPhysicalRoot().unrestrictedTraverse(url)
@@ -129,7 +129,7 @@
"""
Returns the URL to a API documentation for a given class.
"""
- names=string.split(klass, '.')
+ names=klass.split('.')
url="%s/Control_Panel/Products/%s/Help/%s.py#%s" % (REQUEST['SCRIPT_NAME'],
names[0], names[1], names[2])
return '<a href="%s">API Documentation</a>' % url
@@ -207,28 +207,28 @@
Reformat a pre tag to get rid of extra indentation
and extra blank lines.
"""
- lines=string.split(match.group(1), '\n')
+ lines=match.group(1).split('\n')
nlines=[]
min_indent=None
for line in lines:
- indent=len(line) - len(string.lstrip(line))
+ indent=len(line) - len(line.lstrip())
if min_indent is None or indent < min_indent:
- if string.strip(line):
+ if line.strip():
min_indent=indent
for line in lines:
nlines.append(line[min_indent:])
while 1:
- if not string.strip(nlines[0]):
+ if not nlines[0].strip():
nlines.pop(0)
else:
break
while 1:
- if not string.strip(nlines[-1]):
+ if not nlines[-1].strip():
nlines.pop()
else:
break
- return "<PRE>%s</PRE>" % string.join(nlines, '\n')
+ return "<PRE>%s</PRE>" % '\n'.join(nlines)
=== Zope/lib/python/Products/ZopeTutorial/__init__.py 1.10 => 1.11 ===
import App.Common
import os.path
-import string
import os
import stat
from DateTime import DateTime
@@ -62,14 +61,14 @@
while 1:
line = f.readline()
- if (string.strip(line) and string.find(line, ' ') != 0) or line=='':
+ if (line.strip() and line.find(' ') != 0) or line=='':
# new topic
if lines:
id = id + 1
topic_id = 'topic_%02d' % id
- text=string.join(lines[1:], '')
+ text=''.join(lines[1:])
text=term_pat.sub(glossaryTerm, text)
- topic=TutorialTopic.TutorialTopic(topic_id, string.strip(lines[0]), spacestrip(text))
+ topic=TutorialTopic.TutorialTopic(topic_id, lines[0].strip(), spacestrip(text))
context.registerHelpTopic(topic_id, topic)
lines=[line]
else:
@@ -89,12 +88,12 @@
"""
l = []
- for x in string.split(txt,"\n"):
+ for x in txt.split("\n"):
if len(x)>2 and x[:2]==' ':
l.append(x[2:])
else: l.append(x)
- return string.join(l,'\n')
+ return '\n'.join(l)
# Glossary functions