Hi everyone, I've created a ZClass and I'm using an HTML table to display certain properties of the class. One of the properties is a date, and I want to display in the table only those instances of the ZClass for which this certain date property is in the future. (It's a job posting ZClass, and I only want to display jobs that haven't yet closed.) I see in the ZQR that there is an 'isFuture' test that looks like it is associated with fmt. ZQR says for isFuture, "Return true if this object represents a date/time later than the time of the call." Can I combine this with a <dtml-if>? Is there a more elegant way? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/ W. St. Paul, MN | | http://slashdot.org/ wilson@visi.com | <dtml-var pithy_quote> | http://linux.com/
On Mon, Sep 25, 2000 at 05:00:47PM -0500, Timothy Wilson wrote:
I've created a ZClass and I'm using an HTML table to display certain properties of the class. One of the properties is a date, and I want to display in the table only those instances of the ZClass for which this certain date property is in the future. (It's a job posting ZClass, and I only want to display jobs that haven't yet closed.)
I see in the ZQR that there is an 'isFuture' test that looks like it is associated with fmt. ZQR says for isFuture, "Return true if this object represents a date/time later than the time of the call."
Can I combine this with a <dtml-if>? Is there a more elegant way?
Yes, like in: <dtml-in some_items sort=date> <dtml-if "date.isFuture()"> [...] </dtml-if> </dtml-in> Where some_items is a list of objects with a date property. I think it's nice enough. You may even collapse everything in a row (untested): <dtml-in "filter(lambda x:x.date.isFuture(), some_items)" sort=date> </dtml-in> -- "This company has performed an illegal operation and will be shut down. If the problem persists, contact your vendor or appeal to a higher court." - Signal11 on slashdot
Hi all I keep finding references everywhere to class variables (e.g. that belong to a class rather than an instance) in ZClasses. I even found some discussions about it in the Zope archive. But although the consensus seems to be that you can do it, no-one seems to know how. Does anyone know how / where you can define them? Seb.
Hello, Whenever I do a
def play(self,sound): return sound
and a
<dtml-var "play('plonk')">
I get a
Error Type: TypeError Error Value: not enough arguments; expected 2, got 1
Now, I thought 'self' was passed _implicitly_, as explained in http://www.zope.org/Documentation/How-To/ExternalMethods, but I'm actually having to do a
<dtml-var "play(this(),'plonk')">
to pass the context to 'self' in the External method. Explanations gratefully received. Thanks, seb.
+-------[ seb ]---------------------- | Hello, | | Whenever I do a | > def play(self,sound): | > return sound You don't define self as a parameter to an external method, so: def play(sound): will work fine in an external method. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
Andrew Kenneth Milton wrote:
+-------[ seb ]---------------------- | Hello, | | Whenever I do a | > def play(self,sound): | > return sound
You don't define self as a parameter to an external method, so:
def play(sound):
will work fine in an external method.
It's not as simple as that. The mechnism involved here is complex and arguably broken. This is becoming a FAQ, see the mailing list archives for previous versions of this discussion which will provide all the detail. cheers, Chris
participants (5)
-
Andrew Kenneth Milton -
Chris Withers -
Marco Mariani -
seb -
Timothy Wilson