RE: [Zope] Formulator - TALES problem
I don't know if this will help you or not, but here's what I had to do to get my form controls working with the date... <dtml-var "_.DateTime().mm()">/<dtml-var "_.DateTime().dd()">/<dtml-var "_.DateTime().year()"> ...of course you can swap around the mm/dd/year as appropriate. Thanks, Derek Wilson -----Original Message----- From: Andreas Tille [mailto:tillea@rki.de] Sent: Tuesday, September 30, 2003 8:23 AM To: Zope user list Subject: [Zope] Formulator - TALES problem 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@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 )
On Tue, 30 Sep 2003, Derek S. Wilson wrote:
I don't know if this will help you or not, but here's what I had to do to get my form controls working with the date...
<dtml-var "_.DateTime().mm()">/<dtml-var "_.DateTime().dd()">/<dtml-var "_.DateTime().year()">
...of course you can swap around the mm/dd/year as appropriate. Well, I'm fairly able to produce strings representing the current date but the Formulator product has the feature which enables the user to provide limits of valus programmatically via TALES and the syntax for this might a little bit clumsy and thus a python method providing the string mm/dd/yyyy is not sufficient here and I have no idea how to proceede.
Thanks anyway Andreas.
participants (2)
-
Andreas Tille -
Derek S. Wilson