[Zope] on dates
Cliff Ford
Cliff.Ford at ed.ac.uk
Mon Oct 11 15:59:31 EDT 2004
This bit of python:
return DateTime(d).strftime('%H:%M, %a %d %b, %Y')
giving this error:
> Error Type: TypeError
> Error Value: int() argument must be a string or a number
means that your item.data is neither an integer nor a string. You could
try to find out what it contains. For example, if you put in this
temporary line you should get the content:
return d
return DateTime(d).strftime('%H:%M, %a %d %b, %Y')
Cliff
massimop at users.berlios.de wrote:
> On Mon, 2004-10-11 at 19:45 +0100, Cliff Ford wrote:
>
>>Just to be clear that we are on the same wavelength, do this:
>
> ok
>
>>Add a python script called test from the Add drop down list.
>>
>>Type d in the Parameter List box
>>
>>Put this and only this in the script textarea, replacing completely the
>>default python script:
>>
>>return DateTime(d).strftime('%H:%M, %a %d %b, %Y')
>>
>>Save and test, typing 2004-10-11 in the Test Value box. It should give
>>you the date.
>
> yes, it does...
>
>
>>Now, in your page template make the call look like this:
>>
>><i tal:content="python: here.test(d='2004-10-11')"></i>
>>
>>Test the page template. If that works,
>
> yes
>
>
>> substitute the typed in date with
>>the value that you are trying to display. If item.data is date string it
>>should just work. If item.data is a more complex object then we are at
>>cross purposes - but it should be because that us what MySQL stores.
>>
>
> this way?
> <i tal:content="python: here.test(d=item.data)"></i>
>
> uhm...
> I get
>
> Error Type: TypeError
> Error Value: int() argument must be a string or a number
>
>
> isn't funny? :)
>
>
>>Cliff
>>
>
> thanks
> massimo
>
> (sorry, I've accidentally answered directly... I'm getting confused:))
>
>
> _______________________________________________
> 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