Hi, try use the latest version of pydal, Mongo adapter has been recently
updated to work with pymongo 3.0
However, I think this is a bug. Can you open a bug report
on https://github.com/web2py/pydal
Paolo
On Saturday, May 2, 2015 at 3:58:13 AM UTC+2, José Borba wrote:
>
> Hi 4 All,
>
> I'm new to mongoDB and still having some problems with a TIME field. When
> I set a TIME field in the table, fill the input field of a sqlform (only
> time is allowed) and send the data to table, all the record is inserted
> without any warning. But when I try to show in the sqlform, I receive a
> message:
>
> <pre>
> <code>
> Traceback (most recent call last):
> File "/home/xxx.../applications/ras/controllers/appadmin.py", line 269,
> in select
> *fields, limitby=(start, stop))
> File "/home/xxx.../gluon/packages/dal/pydal/objects.py", line 2026, in
> select
> return adapter.select(self.query,fields,attributes)
> File "/home/xxx.../gluon/packages/dal/pydal/adapters/mongo.py", line
> 353, in select
> result = processor(rows, fields, newnames, False)
> File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line
> 1596, in parse
> value = self.parse_value(value,ft,blob_decode)
> File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line
> 1450, in parse_value
> return self.parsemap[key](value,field_type)
> File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line
> 1472, in parse_time
> time_items = map(int,str(value)[:8].strip().split(':')[:3])
> ValueError: invalid literal for int() with base 10: '2000-01-'
> </code>
> </pre>
>
> Trying to understand what happened, I'm googled for some info, and found
> the Mongo adapter code (yes, I didn't tried in my own computer).
>
> Reading the code (in pydal/adapters/mongo.py), I see a (possible) clue:
> The lines 148 to 163 is, in some way, weird for my reading. Maybe I
> misunderstood some point, but this
>
> <pre>
> <code>
> t = datetime.time(0,0,0)
> </code>
> </pre>
>
> is a formatter for a field type DATE, and this
>
> <pre>
> <code>
> t = datetime.date(2000,1,1)
> </code>
> </pre>
>
> is a formatter for a field type TIME ?
>
> Best regards, and keep going the invaluable work with this framework.
>
> --
> José Ricardo Borba
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.