[Zope] Help please = mxDateTime needed in Zope

Tony McDonald tony.mcdonald@ncl.ac.uk
Wed, 3 May 2000 15:14:26 +0100


At 9:44 am -0400 3/5/00, Jason Cunliffe wrote:
>Hello
>
>An intermodal transport project I am working on  needs more advanced
>DateTime tools than native Zope or the [lovely] CalendarTag product offer.
>
>I've looked at the Python package mxDateTime
>http://starship.python.net/~lemburg/mxDateTime.html
>
>...and YES  it's just what we want.

It's certainly very full featured.

>Q: How can we get _FULL_ access to all those
>features/functions/paramters/etc in Zope via DTML or otherwise?
>
>>>>Strategic and technical advice is needed... PythonExternal Methods vs.
>ZopeProduct vs. ???
>
>We've tried wrapping some test functions from mxDateTime as PythonExternal
>methods, but [argghh] cannot pass parameters to them. Works ok in Python but
>not in Zope 8-(

Jason,
There's another module called DateTime in the lib/python directory. 
This may well be causing conflicts with importing the relevant 
methods. You're probably seeing this namespace clash.

This is similar to the PIL "Image" namespace clash that was mentioned 
on the list a while ago. The archives might be able to help.

Shane Hathaway posted a message today about a DateTime patch, that 
fixes some outstanding issues with it.

>Is it possible to pass parameters to and from DTML to External Python
>Methods?
>If so How..

Try this;

<dtml-call "external_method1(REQUEST)"> or
<dtml-var "external_method2(param1=value1,param2=value2)">

where external_method1  is
def external_method1(self, REQUEST):
     # do stuff
     # strictly speaking you can get REQUEST from
     url_value = self.REQUEST['URL']
     # now do some stuff that is not designed to return anything to 
the web browserL,
     # such as doing some management of your Zope installation
     return

and external_method2 is
def external_method2(self, param1, param2):
     import math
     # hugely complex maths that uses the Riemann-Zeta function and 
yields the variable 'forty_two'
     return forty_two

There are some documents on www.zope.org that describe how to use 
external methods. That and the archived list on egroups.com and Chris 
Withers' archive at http://zope.nipltd.com/public/lists.html should 
help you out.


>My dream is that mxDateTime becomes part of standard Python and thus Zope.
>But I confess I really do not undersatnd the realtionship between modules in
the Python directory and what is available to call from Zope. Help.
]

I'd certainly like to see the mxDateTime function being used as a 
'drop-in' replacement for the inbuilt DateTime. DCs reply is usually 
"ok, where's the patch?" - quite rightly!!. Trouble is my Python 
isn't up to that the moment.


>Really hoping there is a good solution
>Thanks in advance.
>
>- Jason Cunliffe

hth
tone
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2