[Zope] Formulator - TALES problem

Michael Dunstan michael at looma.co.nz
Fri Oct 3 07:19:44 EDT 2003


Hi Andreas

Try wrapping the DateTime in python script (say with id GetDateTime) 
then accessing that script via acquisition from the form object. For 
example:

   python: form.GetDateTime()

Note that form is the formulator object within ZODB itself. DateTime is 
not an attribute of that ZODB object (not even with with the use of 
acquistion). Python scripts have some objects already floating about in 
the namespace when they are called. DateTime is one such example of an 
object floating about in that namespace.  An implicit import of 
DateTime if you like.

righto
michael

On Wednesday, October 01, 2003, at 03:22 AM, Andreas Tille wrote:

> Hello,
>
> I tried to set the End Datetime for an datetime Formulator object to
> the current time.  I uses TALES and started with
>
>      python: form.DateTime()
>
> This failed with
>
>      Error Type: AttributeError
>      Error Value: DateTime
>
> Now I created a Python script named 'jetzt' which just does
>
>      return DateTime()  and alternatively I tried
>      return str(DateTime())
>
> moreover I tried several different formats.  The error.log of Test
> method of the Formulator object was always like:
>
> Traceback (innermost last):
>   Module ZPublisher.Publish, line 98, in publish
>   Module ZPublisher.mapply, line 88, in mapply
>   Module ZPublisher.Publish, line 39, in call_object
>   Module Shared.DC.Scripts.Bindings, line 252, in __call__
>   Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec
>   Module App.special_dtml, line 174, in _exec
>   Module DocumentTemplate.DT_Util, line 201, in eval
>    - __traceback_info__: render
>   Module <string>, line 0, in ?
>   Module Products.Formulator.Field, line 177, in render
>   Module Products.Formulator.Field, line 155, in _render_helper
>   Module Products.Formulator.Widget, line 671, in render
>   Module Products.Formulator.Field, line 191, in render_sub_field
>   Module Products.Formulator.Field, line 155, in _render_helper
>   Module Products.Formulator.Widget, line 425, in render
>   Module Products.Formulator.Widget, line 328, in render_items
>   Module Products.Formulator.Field, line 106, in get_value
>   Module Products.Formulator.MethodField, line 52, in __call__
>   Module Products.Formulator.StandardFields, line 148, in 
> override_year_items
>   Module Products.Formulator.Field, line 97, in get_value
>   Module Products.Formulator.TALESField, line 43, in __call__
>   Module Products.PageTemplates.TALES, line 217, in evaluate
>    - Expression: <PythonExpr form.jetzt()>
>    - Names:
>       {'default': <Products.PageTemplates.TALES.Default instance at 
> 0x86c0cd4>,
>        'field': <DateTimeField instance at 9022ce0>,
>        'form': <BoundMethod instance at 9585280>,
>        'loop': <SafeMapping instance at 86e82e8>,
>        'nothing': None,
>        'repeat': <SafeMapping instance at 86e82e8>}
>   Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
>    - __traceback_info__: form.jetzt()
>   Module Python expression "form.jetzt()", line 2, in f
> AttributeError: jetzt
>
>
> Any hint which kind of value I have to return as a valid TALES?
>
> Kind regards
>
>           Andreas.
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>




More information about the Zope mailing list