some explanations needed on "prettydate"

35 views
Skip to first unread message

Pystar

unread,
Aug 13, 2012, 5:11:00 PM8/13/12
to web...@googlegroups.com
Hi guys, 
I am storing my timestamp in my database using the datetime.datetime.now() directive. And on display I want to use prettydate in my views, 
I am doing this in my views {{=prettydate(row.timestamp, T)}} but it fails silently by not displaying anything. I have tried it in the web2py shell and it works but doesnt work in my views, 
what am I doing wrong?
Need replies ASAP

Anthony

unread,
Aug 13, 2012, 5:29:20 PM8/13/12
to web...@googlegroups.com
prettydate() does this:

 try:
     dt
= datetime.datetime.now() - d
 
except:
     
return ''

In the view, maybe try:

{{import datetime}}
{{=datetime.datetime.now() - row.timestamp}}

and see what error is generated to help figure out the problem.

Anthony

Bruno Rocha

unread,
Aug 13, 2012, 8:10:37 PM8/13/12
to web...@googlegroups.com

It also happens for me, I did not found a better way to solve, but I think prettydate needs to be rewritten for accurate responses.




--
 
 
 

Reply all
Reply to author
Forward
0 new messages