What about as_dict(datetime_to_str=True)?

On Thu, Mar 25, 2010 at 7:33 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:

> On a second though, this cannot be changed, because it will break web
> services example and therefore backward compatibility. @service.xmlrpc
> for example cannot serialize datetime.
>
> Anyway you can do
>
> ...select().as_list(datetime_to_str=False)
>
>
> On Mar 25, 4:58 pm, Tito Garrido <titogarr...@gmail.com> wrote:
> > I prefer the serialized data on as_dict result :)
> >
> >
> >
> > On Thu, Mar 25, 2010 at 6:36 PM, mdipierro <mdipie...@cs.depaul.edu>
> wrote:
> > > That's how it is. There are historical reasons for it.
> >
> > > select().as_dict(...) was designed to return a representation that
> > > could be serialized by simplejson and other serializers. simplejson
> > > cannot serialize date/datetime/time objects. This is no longer the
> > > case since I patched simplejson.
> >
> > > row.as_dict() is instead used internally to compare two records.
> >
> > > I think we can change one or the other and make them consistent. What
> > > do people think?
> >
> > > Massimo
> >
> > > On Mar 25, 4:29 pm, Tito Garrido <titogarr...@gmail.com> wrote:
> > > > as_list on a select returns something like:
> >
> > > > [{'id': 11, 'time': '08:00:00'}]
> >
> > > > using as_dict on a record returns:
> >
> > > > [{'id': 11, 'horario': datetime.time(8, 0)}]
> >
> > > > Is that expected?
> >
> > > > Regards,
> >
> > > > Tito
> >
> > > > --
> >
> > > > Linux User #387870
> > > > .........____
> > > > .... _/_õ|__|
> > > > ..º[ .-.___.-._| . . . .
> > > > .__( o)__( o).:_______
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com>
> <web2py%2bunsubscr...@googlegroups.com<web2py%252bunsubscr...@googlegroups.com>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
> >
> > --
> >
> > Linux User #387870
> > .........____
> > .... _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:_______
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>


-- 

Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to