I'm getting this error when using datetime;
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
Traceback (most recent call last):
File "/home/maurice/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/maurice/web2py/applications/Welln/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/Hestque_Wellness/controllers/default.py>
, line 616, in <module>
File "/home/maurice/web2py/gluon/globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "/home/maurice/web2py/gluon/tools.py", line 3867, in f
return action(*a, **b)
File "/home/maurice/web2py/applications/Welln/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/Hestque_Wellness/controllers/default.py>
, line 389, in diary
results = rows(db.diary.today == diary_date).select()
File "/usr/local/lib/python2.7/dist-packages/pydal/objects.py", line 2250,
in select
return adapter.select(self.query, fields, attributes)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 233, in select
return self.__select(query, fields, **attributes)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 294, in __select
groupby=groupby, distinct=distinct, having=having)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 621, in __init__
self.query_dict = adapter.expand(self.query)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 177, in _expand
result = op(first, second, **optional_args)
File "/usr/local/lib/python2.7/dist-packages/pydal/dialects/mongo.py",
line 109, in _and
self.expand(second, query_env=query_env)]}
File "/usr/local/lib/python2.7/dist-packages/pydal/dialects/__init__.py",
line 96, in expand
return self.adapter.expand(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 177, in _expand
result = op(first, second, **optional_args)
File "/usr/local/lib/python2.7/dist-packages/pydal/dialects/mongo.py",
line 57, in wrap
return f(self, first, second, *args, pipeline=pipeline, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pydal/dialects/mongo.py",
line 144, in eq
self.expand(second, first.type, query_env=query_env)}
File "/usr/local/lib/python2.7/dist-packages/pydal/dialects/__init__.py",
line 96, in expand
return self.adapter.expand(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 191, in _expand
result = self.represent(expression, field_type)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py",
line 199, in represent
return super(Mongo, self).represent(obj, field_type)
File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line
335, in represent
return self.representer.represent(obj, field_type)
File
"/usr/local/lib/python2.7/dist-packages/pydal/representers/__init__.py",
line 251, in represent
rv = self.get_representer_for_type(field_type)(rv, field_type)
File
"/usr/local/lib/python2.7/dist-packages/pydal/representers/__init__.py",
line 139, in __call__
return self.adapt(self.call(value, field_type))
File
"/usr/local/lib/python2.7/dist-packages/pydal/representers/__init__.py",
line 136, in _call
return self.inner_call(value)
File
"/usr/local/lib/python2.7/dist-packages/pydal/representers/__init__.py",
line 124, in _inner_call
return self.obj.f(self.representer, value, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pydal/representers/mongo.py",
line 28, in _date
return datetime.datetime.combine(value, t)
TypeError: combine() argument 1 must be datetime.date, not str
What could be the issue and how do i solve it.
My code is:
from datetime import date
if request.vars.current_date == None:
diary_date = date.today()
else:
diary_date = request.vars.current_date
session.date = diary_date
rows = db(db.calcdiary.created_by == auth.user_id)
results = rows(db.calcdiary.today == diary_date).select()
--
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.