[Zope] ZopeTime() in python script ...
andres@corrada.com
andres@corrada.com
Thu, 10 May 2001 08:36:40 -0400
On Thu, May 10, 2001 at 01:56:17PM +0200, Mike Blake wrote:
> This works, BUT I would like to forget the dtml
> and just write it in python. Something like this?:
>
> # str=""
> # str = str + ZopeTime().year()
> # if ZopeTime().month()<10:
> # str = str + "0"
> # str = str + ZopeTime().month()
> # if ZopeTime().month()<10:
> # str = str + "0"
> # str = str + ZopeTime().day()
> # return str
>
> But this gives an error:
> Error Type: NameError
> Error Value: ZopeTime
>
> I have this as a python script object and although
> it would return a string ok, I get an error when
> trying to access ZopeTime().
>
> I am currently losing my mind trying different
> arguments and import statements, but getting nowhere
> fast. How do I access the variables and methods
> (those that would normally be available to a dtml
> method) in a python script?
>
> thanks,
> mike
>
> --
> [morcilla@ketden.com chikoon]$ whoami
> Mike Blake
>
You can access objects available under dtml by using "context" or
"container". So something like:
context.ZopeTime()
should work.
------------------------------------------------------
Andres Corrada-Emmanuel Email: andres@corrada.com
Internet Programming http://www.mamey.com
------------------------------------------------------