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.