Does this break backward compatibility, or do you consider this a bug? Note, Pystar's problem is not that the function was failing silently, but that his item.now value was a string when he expected it to be a datetime object (i.e., now it will still fail, but not silently).
Anthony On Thursday, August 16, 2012 1:07:57 PM UTC-4, Massimo Di Pierro wrote: > > you are right. I think this is now fixed on google code (not on github > because I am behind a firewall and cannot push to github right now). > > Massimo > > On Thursday, 16 August 2012 00:42:34 UTC-5, Anthony wrote: >> >> Massimo, note that prettydate() does fail silently due to a try/except >> (the except returns '') -- see >> https://groups.google.com/forum/#!msg/web2py/Rguuny9E3X8/-a976Tjx4EIJ%5B1-25%5D >> . >> >> Anthony >> >> On Thursday, August 16, 2012 1:14:47 AM UTC-4, Massimo Di Pierro wrote: >>> >>> Try: >>> >>> {{=prettydate(item.timestamp)}} {{=item.timestamp}} to check there is >>> actually something to display. >>> >>> functions cannot fail silently in view. If they are executed and fail, >>> they raise an exception. >>> >>> On Wednesday, 15 August 2012 22:24:08 UTC-5, Pystar wrote: >>>> >>>> still doesnt work >>>> >>>> On Wednesday, August 15, 2012 1:45:47 AM UTC+1, Pystar wrote: >>>>> >>>>> OK, After doing type(item.now). I discovered that web2py is escaping >>>>> my retrieved data from the database and converting everything into >>>>> strings. >>>>> And since prettydate() doesnt work on strings but datetime objects, it >>>>> fails. >>>>> For this prettydate to work in the views, I would have to >>>>> import datetime and do >>>>> datetime.datetime.strptime(item.now, [format]) in order to format the >>>>> datetime object that has now being converted into a string back to a >>>>> datetime object and then allow prettydate() to work its magic. The only >>>>> problem I am having now is knowing the correct format to pass to the >>>>> strptime() function as all I have used is raising this error: "2012-08-15 >>>>> 01:38:15.019797' does not match format '%Y, %m, %d, %H, %M, %S, %f'" >>>>> I need help thanks >>>>> >>>>> On Tuesday, August 14, 2012 11:57:45 PM UTC+1, Pystar wrote: >>>>>> >>>>>> It fails silently, it outputs nothing. >>>>>> >>>>>> On Tuesday, August 14, 2012 11:34:54 PM UTC+1, Anthony wrote: >>>>>>> >>>>>>> item.now is a field in my database whose default value is >>>>>>>> request.now. >>>>>>> >>>>>>> >>>>>>> Yes, I understand, but can you report the error raised as well as >>>>>>> checking the type of item.now? >>>>>>> >>>>>>> Anthony >>>>>>> >>>>>> --

