[Zope] [FAQTS] ZOPE Knowledge Base Update -- July 30th, 2000
Fiona Czuczman
Fiona Czuczman <fiona@sitegnome.com>
30 Jul 2000 05:28:13 -0000
Hi Guys,
The latest entries to be entered into http://zope.faqts.com
regards,
Fiona Czuczman
Including:
- Benchmarking between Zope and Tomcat
- How can I get the Zope tutorial to work?
- Is there an easy way to simulate the functionality of a while loop in
DTML?
- What is the best method to enter more attributes about DTML Document?
- How is it possible to create "show DTML-Source"-link like on some
sites on zope.org?
- Is there an easy way to increment the month or year of the DateTime
object?
## New Entries #################################################
-------------------------------------------------------------
Benchmarking between Zope and Tomcat
http://www.faqts.com/knowledge-base/view.phtml/aid/5062
-------------------------------------------------------------
Fiona Czuczman
J. Atwood
Benchmarking between Zope and Tomcat
http://www.zope.org/Members/BwanaZulia/zope_benchmarks/tomcat1.html
(1 of 4 rounds)
-------------------------------------------------------------
How can I get the Zope tutorial to work?
http://www.faqts.com/knowledge-base/view.phtml/aid/5063
-------------------------------------------------------------
Fiona Czuczman
Amos Latteier
Here's what to do:
* Get Zope 2.2, download it, install it.
* Log in to Zope with the super user account.
* Create a manager account by going to the User Folder and adding a
new user, and giving them the Manager role.
* Quit your browser to log out.
* Log into Zope as the manager you just created.
* Create a Zope Tutorial, by adding it from the product add list.
* Now do the tutorial.
-------------------------------------------------------------
Is there an easy way to simulate the functionality of a while loop in DTML?
http://www.faqts.com/knowledge-base/view.phtml/aid/5065
-------------------------------------------------------------
Fiona Czuczman
Patrick Lewis
This is real ugly, but you asked (untested, but you get the idea):
<dtml-try>
<dtml-in "_.range(1000)">
<dtml-if whileCondition> <!-- Your logic test -->
<!-- Do stuff in while loop -->
<dtml-else>
<dtml-raise type="conditionFalse">errormsg</dtml-raise>
</dtml-if>
</dtml-in>
<dtml-except conditionFalse>
<!-- Fall out of 'while' loop. -->
<dtml-else>
<dtml-raise type="RangeError">Oops! Exception never
raised.</dtml-raise>
</dtml-try>
This only works if the loop will cycle less than 1000 times. Needless
to say, this is done a lot easier in Python.
-------------------------------------------------------------
What is the best method to enter more attributes about DTML Document?
http://www.faqts.com/knowledge-base/view.phtml/aid/5098
-------------------------------------------------------------
Fiona Czuczman
Chris McDonough
Problem:
Short and probably obvious problem: what can I do to be asked for more
properties while creating DTML Document (say I wanna be asked about
description and keywords which I use in meta tags)?
Solution:
There's not a particularly obvious solution other than to define a
ZClass which inherits from DTML Document and exposes a constructor form
that asks for these properties as well as an edit form that does same.
See the ZClass tutorial on Zope.org at
http://www.zope.org/Documentation/Guides/ZDG-HTML/ZDG.html
to get started.
-------------------------------------------------------------
How is it possible to create "show DTML-Source"-link like on some sites on zope.org?
http://www.faqts.com/knowledge-base/view.phtml/aid/5099
-------------------------------------------------------------
Fiona Czuczman
Chris Withers
Put a link as follows on your page:
<a href="view_source">show DTML-Source</a>
Then create a dtml method called view_source.
What do you put in it? Well, see the following:
http://www.zope.org/view_source/view_source
-------------------------------------------------------------
Is there an easy way to increment the month or year of the DateTime object?
http://www.faqts.com/knowledge-base/view.phtml/aid/5100
-------------------------------------------------------------
Fiona Czuczman
Jim Sanford
Problem:
Adding a numeric value increments the day. Incrementing the year is
easily doable, but incrementing the month is significantly more
difficult. So I'm just curious if there's a function that will actualy
modify the parts of a DateTime object, or something way that I'm not
thinking of to easily increment the month.
Solution:
<dtml-var
"_.DateTime(_.str(ZopeTime().month()+1)+'/'+_.str(ZopeTime()
.day())+'/'+_.str(ZopeTime().year()))">
will give you a datetime object one month in the future
## Edited Entries ##############################################
-------------------------------------------------------------
Is there a way I can grab the time value on my current system that Zope is running on with a MILLISECOND precision?
http://www.faqts.com/knowledge-base/view.phtml/aid/4964
-------------------------------------------------------------
Fiona Czuczman
Shane Hathaway
Works on 2.2.0:
<dtml-var expr="_.DateTime().millis()">