[Zope] Xron TypeError revisited

Loren Stafford lstaffor@dynalogic.com
Tue, 12 Sep 2000 10:47:35 -0700


From: "Dwayne Morrison" <dcmorrison@tidewater.net>


> Hello,
>
> I posted earlier about Xron 0.0.9 event scheduling woes.  One of my stabs
> in the dark seems to work.
> I removed the 'this()' parameter entirely and
> now am able to schedule events via DTML.

I'm glad you figured out how to proceed.

I wondered why this() was necessary in the first place. Calls to python
procedures usually pass this() implicitly. However, here we have a DTML to
Python call, and I was never very clear about how they work.

> I also had to add the 'US/Eastern'
> parameter to the DateTime call to get a current value for DateTime.  It
was
> returning 12/31/1969.

Hmm, this is different from what I get. DateTime() reliably gives me the
current time (in all Zope versions I have used). DateTime(0) is supposed to
give 1969/12/31. I haven't a clue why you would get different results.

>
> Xron documentation (works on Zope 2.1.3):
>
> <dtml-with "manage_addProduct['Xron']">
>    <dtml-call expr="manage_addXronDTMLMethod(
>      this(),
>      'SchedMethodId1',
>      'Scheduled Method 1 Title',
>      file = 'Content-Type: text/plain\n\nBANG!!!',
>      executeAt = _.DateTime()+14
>    )">
> </dtml-with>
>
>
> Here's what works for me on 2.2.0:
>
> <dtml-with "manage_addProduct['Xron']">
>    <dtml-call expr="manage_addXronDTMLMethod(
>      'SchedMethodId1',
>      'Scheduled Method 1 Title',
>      file = 'Content-Type: text/plain\n\nBANG!!!',
>      executeAt = _.DateTime('US/Eastern')+14
>    )">
> </dtml-with>
>
>
> I'd appreciate any insight as to why this works without the 'this()'
> parameter in 2.2.0.

I think the real question is why it was necessary with Zope 2.1.3.

FWIW, you can also explicily name the title parameter:

<dtml-with "manage_addProduct['Xron']">
<dtml-call expr="manage_addXronDTMLMethod(
           'SchedMethodId2',
            title='Scheduled Method 2 Title',
            executeAt = _.DateTime()+14.0,
            periodDays = 0.0,
            file = 'Content-Type: text/plain\n\nBANG!!!',
            )">
</dtml-with>

I hope others on the list will chime in with their knowledge. I don't think
either of these questions is specifically about Xron itself.

-- Loren