I'm getting the error "can't adapt type 'Decimal'" from time to
time in my Django web site. Once I restart Apache it will works for
few hours, then some users will start to get this error.
Of the 2 web site that I have, It only happens where I make request
using the the Q objects.
For example this request :
projets = Projet.objects.filter(Q(termine = u'Non') |
Q(heure_difference__gt = 0 |
Q(termine = u'Oui') &
Q(base_renumeration = u'Forfait'))
for projet in projets:
Wich will end up and with the following traceback :
Traceback:
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
92. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/auth/
decorators.py" in __call__
78. return self.view_func(request, *args, **kwargs)
File "/var/www/django/defitek/gestion/views.py" in projet_en_cours
128. for projet in projets:
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_result_iter
106. self._fill_cache()
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_fill_cache
692.
self._result_cache.append(self._iter.next())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
iterator
238. for row in self.query.results_iter():
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in results_iter
287. for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in execute_sql
2369. cursor.execute(sql, params)
File "/usr/lib/python2.4/site-packages/django/db/backends/util.py" in
execute
19. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /projet_en_cours/
Exception Value: can't adapt type 'Decimal'
Here are the value that it tryed to use in the request :
return self.cursor.execute(sql, params) ...
▶ Local vars
Variable
Value
params
(u'Non', Decimal("0"), u'Oui', u'Forfait')
self
<django.db.backends.util.CursorDebugWrapper object at 0x9a585ec>
sql
None
start
1277468406.010195
stop
1277468406.010242
I'm using : Django 1.1.1, CentOS 5.5, Python-2.4.3-27, mod_wsgi 3.2
and psycopg2-2.2.1
I read many thread that had a can't adapt error, it seems to be
something wrong with psycopg2. But I have yet to figure out how to
fix this.
Please help. Thank you.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment