[Zope-Checkins] CVS: Zope/lib/python/Products/ZopeTutorial - TutorialTopic.py:1.13 __init__.py:1.12
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:25:19 -0400
Update of /cvs-repository/Zope/lib/python/Products/ZopeTutorial
In directory cvs.zope.org:/tmp/cvs-serv27658/ZopeTutorial
Modified Files:
TutorialTopic.py __init__.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/Products/ZopeTutorial/TutorialTopic.py 1.12 => 1.13 ===
--- Zope/lib/python/Products/ZopeTutorial/TutorialTopic.py:1.12 Mon Mar 11 10:49:21 2002
+++ Zope/lib/python/Products/ZopeTutorial/TutorialTopic.py Wed Aug 14 18:25:19 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 OFS.Folder
from HelpSys.HelpTopic import TextTopic
@@ -32,7 +32,7 @@
self.title=title
text=str(StructuredText.HTML(text))
self.obj=HTML(pre_pat.sub(clean_pre, text))
-
+
index_html=DTMLFile('dtml/lessonView', globals())
def checkInstallation(self, REQUEST):
@@ -56,7 +56,7 @@
if not ok:
REQUEST.set('hide_next', 1)
return ok
-
+
def lessonURL(self, id, REQUEST):
"""
URL of the examples for a lesson
@@ -65,7 +65,7 @@
return '%s/lesson%d' % (REQUEST['tutorialExamplesURL'], id)
except KeyError:
return ""
-
+
def tutorialShowLesson(self, id, REQUEST):
"""
Navigate management frame to a given lesson's screen.
@@ -87,7 +87,7 @@
Note: make sure that you have cookies turned on in your browser.
</p>
"""
-
+
return """\
<SCRIPT LANGUAGE="javascript">
<!--
@@ -115,7 +115,7 @@
self.obj=HTML(text)
index_html=DTMLFile('dtml/glossaryView', globals())
-
+
def formatted_content(self, REQUEST):
"""
Custom stx formatting for tutorial topics
@@ -168,11 +168,11 @@
except:
folder._p_jar=self.Destination()._p_jar
folder.manage_importObject(tutorialExamplesFile)
-
+
# acquire REQUEST if necessary
if REQUEST is None:
REQUEST=self.REQUEST
-
+
# Set local roles on examples
changeOwner(folder, REQUEST['AUTHENTICATED_USER'])
@@ -197,11 +197,11 @@
for user, roles in obj.get_local_roles():
if 'Owner' in roles:
obj.manage_delLocalRoles([user])
- break
+ break
obj.manage_setLocalRoles(owner.getUserName(), ['Owner'])
for subobj in obj.objectValues():
changeOwner(subobj, owner)
-
+
def clean_pre(match):
"""
Reformat a pre tag to get rid of extra indentation
@@ -215,20 +215,20 @@
indent=len(line) - len(line.lstrip())
if min_indent is None or indent < min_indent:
if line.strip():
- min_indent=indent
+ min_indent=indent
for line in lines:
nlines.append(line[min_indent:])
-
+
while 1:
if not nlines[0].strip():
nlines.pop(0)
else:
break
-
+
while 1:
if not nlines[-1].strip():
nlines.pop()
else:
break
-
+
return "<PRE>%s</PRE>" % '\n'.join(nlines)
=== Zope/lib/python/Products/ZopeTutorial/__init__.py 1.11 => 1.12 ===
--- Zope/lib/python/Products/ZopeTutorial/__init__.py:1.11 Mon Mar 11 10:49:21 2002
+++ Zope/lib/python/Products/ZopeTutorial/__init__.py Wed Aug 14 18:25:19 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 TutorialTopic
import App.Common
@@ -41,15 +41,15 @@
help.lastRegistered >= DateTime(os.stat(lesson_path)[stat.ST_MTIME]):
return
help.lastRegistered=DateTime()
-
+
# delete old help topics
for id in help.objectIds('Help Topic'):
help._delObject(id)
-
+
# create glossary
text=open(glossary_path).read()
text=term_pat.sub(defineTerm, text)
-
+
glossary=TutorialTopic.GlossaryTopic('tutorialGlossary',
'Zope Tutorial Glossary', text)
context.registerHelpTopic('tutorialGlossary', glossary)
@@ -58,7 +58,7 @@
f=open(lesson_path)
lines=[]
id=0
-
+
while 1:
line = f.readline()
if (line.strip() and line.find(' ') != 0) or line=='':
@@ -69,7 +69,7 @@
text=''.join(lines[1:])
text=term_pat.sub(glossaryTerm, text)
topic=TutorialTopic.TutorialTopic(topic_id, lines[0].strip(), spacestrip(text))
- context.registerHelpTopic(topic_id, topic)
+ context.registerHelpTopic(topic_id, topic)
lines=[line]
else:
lines.append(line)
@@ -81,12 +81,12 @@
def spacestrip(txt):
""" dedent text by 2 spaces !
- We need this to workaround a nasty bug in STXNG.
+ We need this to workaround a nasty bug in STXNG.
STXNG creates empty <pre>..</pre> when then text start
if a level > 1. This fix is lame. The problem should be fixed
inside STXNG
"""
-
+
l = []
for x in txt.split("\n"):
if len(x)>2 and x[:2]==' ':