[Zope-Checkins] CVS: Zope2 - TutorialTopic.py:1.8.2.1 __init__.py:1.8.4.1 glossary.stx:1.3.2.1 tutorial.stx:1.4.2.2
Amos Latteier
amos@digicool.com
Tue, 3 Jul 2001 19:25:23 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/Products/ZopeTutorial
In directory korak.digicool.com:/tmp/cvs-serv13498
Modified Files:
Tag: Zope-2_4-branch
TutorialTopic.py __init__.py glossary.stx tutorial.stx
Log Message:
Merged tutorial fixes to 2.4 branch. Makes tutorial more robust in the face of incorrectly installed example, and fixes problems that STXNG exposed.
--- Updated File TutorialTopic.py in package Zope2 --
--- TutorialTopic.py 2001/06/21 23:14:54 1.8
+++ TutorialTopic.py 2001/07/03 23:25:22 1.8.2.1
@@ -106,6 +106,28 @@
self.obj=HTML(pre_pat.sub(clean_pre, text))
index_html=DTMLFile('dtml/lessonView', globals())
+
+ def checkInstallation(self, REQUEST):
+ """
+ Returns false if the tutorial examples are not correctly
+ installed. Also sets the 'hide_next' variable in the request
+ if the examples are not installed.
+ """
+ ok=0
+ if REQUEST.has_key('tutorialExamplesURL'):
+ url=REQUEST['tutorialExamplesURL']
+ base=REQUEST['BASE1']
+ if string.index(url, base) == 0:
+ url=url[len(base):]
+ try:
+ self.getPhysicalRoot().unrestrictedTraverse(url)
+ ok=1
+ except:
+ pass
+
+ if not ok:
+ REQUEST.set('hide_next', 1)
+ return ok
def lessonURL(self, id, REQUEST):
"""
@@ -121,7 +143,8 @@
Navigate management frame to a given lesson's screen.
"""
url=self.lessonURL(id, REQUEST)
- if not url:
+ if not url or not self.checkInstallation(REQUEST):
+ REQUEST.set('hide_next', 0)
return """\
<p class="warning">
Zope cannot find the tutorial examples.
@@ -149,6 +172,31 @@
>Show lesson examples</a> in another window.
</p>""" % (url, url, url)
+
+ tutorialNavigation=DTMLFile('dtml/tutorialNav', globals())
+
+
+class GlossaryTopic(TutorialTopic):
+ """
+ A Tutorial Glossary Help Topic
+ """
+
+ def __init__(self, id, title, text):
+ self.id=id
+ self.title=title
+ self.obj=HTML(text)
+
+ index_html=DTMLFile('dtml/glossaryView', globals())
+
+ def formatted_content(self, REQUEST):
+ """
+ Custom stx formatting for tutorial topics
+ """
+ text=self.obj(self, REQUEST)
+ text=str(StructuredText.HTML(text))
+ pre_pat.sub(clean_pre, text)
+ return text
+
def apiLink(self, klass, REQUEST):
"""
Returns the URL to a API documentation for a given class.
@@ -164,8 +212,6 @@
"""
url="%s/Control_Panel/Products/OFSP/Help/dtml-%s.stx" % (REQUEST['SCRIPT_NAME'], tag)
return '<a href="%s">DTML Reference</a>' % url
-
- tutorialNavigation=DTMLFile('dtml/tutorialNav', globals())
addTutorialForm=DTMLFile('dtml/tutorialAdd', globals())
--- Updated File __init__.py in package Zope2 --
--- __init__.py 2001/06/14 21:01:22 1.8
+++ __init__.py 2001/07/03 23:25:22 1.8.4.1
@@ -123,7 +123,8 @@
text=open(glossary_path).read()
text=term_pat.sub(defineTerm, text)
- glossary=TutorialTopic.TutorialTopic('tutorialGlossary', 'Zope Tutorial Glossary', text)
+ glossary=TutorialTopic.GlossaryTopic('tutorialGlossary',
+ 'Zope Tutorial Glossary', text)
context.registerHelpTopic('tutorialGlossary', glossary)
# create lessons
--- Updated File glossary.stx in package Zope2 --
--- glossary.stx 2001/06/21 23:14:54 1.3
+++ glossary.stx 2001/07/03 23:25:22 1.3.2.1
@@ -1,11 +1,13 @@
Glossary
For general information about Zope <a
- href="http://www.zope.org/SiteIndex/searchForm" target="_blank">search</a> Zope.org.
+ href="http://www.zope.org/SiteIndex/searchForm"
+ target="_blank">search</a> Zope.org.
- For Zope documentation try the <a href="http://zdp.zope.org" target="_blank">Zope
- Documentation Project</a> site and the <a
- href="http://www.zope.org/Documentation" target="_blank">documentation area</a> on Zope.org.
+ For Zope documentation try the <a href="http://zdp.zope.org"
+ target="_blank">Zope Documentation Project</a> site and the <a
+ href="http://www.zope.org/Documentation"
+ target="_blank">documentation area</a> on Zope.org.
[DateTime] -- A DTML function to get the current time or to create a
date time object given a string.
@@ -17,8 +19,8 @@
results in web pages.
For more information on DTML see the <a
- href="http://www.zope.org/Members/michel/ZB/DTML.dtml" target="_blank">DTML
- chapter</a> of The Zope Book.
+ href="http://www.zope.org/Members/michel/ZB/DTML.dtml"
+ target="_blank">DTML chapter</a> of The Zope Book.
[DTML Document] -- A Zope object for a web page.
You can use DTML tags in a DTML document.
@@ -27,7 +29,7 @@
href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
target="_blank">Basic Objects chapter</a> of The Zope Book.
- <dtml-var "apiLink('OFSP'+'.DTMLDocument.DTMLDocument', REQUEST)">
+ <dtml-var "apiLink('OFSP.DTMLDocument.DTMLDocument', REQUEST)">
[DTML Method] -- A Zope object that holds a piece of content that can
be inserted into a web page. You can use DTML tags in a DTML Method.
@@ -36,7 +38,7 @@
href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
target="_blank">Basic Objects chapter</a> of The Zope Book.
- <dtml-var "apiLink('OFSP'+'.DTMLMethod.DTMLMethod', REQUEST)">
+ <dtml-var "apiLink('OFSP.DTMLMethod.DTMLMethod', REQUEST)">
[Delete] -- Remove an object from the current Folder. Unlike Cut, this
does not place a copy of the object in the clipboard.
@@ -105,7 +107,7 @@
href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
target="_blank">Basic Objects chapter</a> of The Zope Book.
- <dtml-var "apiLink('OFSP'+'.Folder.Folder', REQUEST)">
+ <dtml-var "apiLink('OFSP.Folder.Folder', REQUEST)">
[HTTP Cookies] -- Cookies allow you to record information in a visitor's
browser. This is commonly used to provide personalization for a web site.
@@ -121,7 +123,7 @@
href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
target="_blank">Basic Objects chapter</a> of The Zope Book.
- <dtml-var "apiLink('OFSP'+'.Image.Image', REQUEST)">
+ <dtml-var "apiLink('OFSP.Image.Image', REQUEST)">
[index_html] -- The name of the default Zope object in a Folder.
When you view a Folder the index_html object will be displayed
@@ -131,7 +133,7 @@
[Mail Host] -- A Zope object that allows you to send email.
Use the <dtml-sendmail> tag to send email.
- <dtml-var "apiLink('MailHost'+'.MailHost.MailHost', REQUEST)">
+ <dtml-var "apiLink('MailHost.MailHost.MailHost', REQUEST)">
[Paste] -- Insert the objects from the clipboard into the current Folder.
@@ -145,7 +147,7 @@
href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
target="_blank">Basic Objects chapter</a> of The Zope Book.
- <dtml-var "apiLink('OFSP'+'.PropertyManager.PropertyManager', REQUEST)">
+ <dtml-var "apiLink('OFSP.PropertyManager.PropertyManager', REQUEST)">
[standard_html_header] -- The standard Zope header object. By
convention this object displays an HTML header.
@@ -166,5 +168,5 @@
href="http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml"
target="_blank">Relational Database chapter</a> of The Zope Book.
- <dtml-var "apiLink('ZSQLMethods'+'.ZSQLMethod.ZSQLMethod', REQUEST)">
+ <dtml-var "apiLink('ZSQLMethods.ZSQLMethod.ZSQLMethod', REQUEST)">
--- Updated File tutorial.stx in package Zope2 --
--- tutorial.stx 2001/07/03 20:08:41 1.4.2.1
+++ tutorial.stx 2001/07/03 23:25:22 1.4.2.2
@@ -22,7 +22,7 @@
object you created in the Zope management screen, and viewing
its "README" document.
- <dtml-unless tutorialExamplesURL>
+ <dtml-unless expr="checkInstallation(REQUEST)">
Install Tutorial Examples