[Zope3-dev] Calling persistent function

Jim Fulton jim at zope.com
Mon Jan 26 10:56:37 EST 2004


Danny Smith wrote:

...

>>Some other notes:
>>
>>- It will eventually be possible to use them via the
>>zpt module
>>   namespace:
>>
>>   modules/foo.bar/myfunc
> 
> 
> That would be great.  I know it does not mean much
> given that python script can be embedded directly into
> a template, but it's more familiar code managment.
> 
> One problem I have with that is that
> modules['time'].asctime() is forbidden in zpt. 

This is because, before you can use a file-system
module, you must make a security assertion for it
in zpt.  The following should work:

<module module="time">
   <allow attributes="asctime" />
</module>

You can also use an interface attribute with allow.

You can use require, rather than allow, but this is
probably bogus.

Obviously, it would be nice for someone to add a lot
of these declarations for standard modules to the standard
z3 configuration.

> How do
> I put the time and date in a zpt template?   This
> definately falls into the category of "one-liner" in
> every web framework I've ever used, including Zope 2.

Yup. Someone needs to take the time to work this out.

Really, a lot more effort needs to go into improving the
scriptors experience. We want that, but we haven't gotten
to it yet.

> As far as I can tell, in Zope 3 I need to create a
> TimeUtility, register it in ZCML, query the utility
> service and then it works.

That would probably be overkill.

> Am I missing something?

Nope.

BTW, whatever API we provide for this, needs to make use of localized
dates and times.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list