Hi,
Hi,
I have the following code fragment that I call via an Ajax call (from
prototype), it throws an exception that I can't tie down - i don't get
any console output and the code runs fine when i simulate it in the
shell - so I assume it's related to the incoming POST parameter. The
result of this is a 500 error, output attached as well. If I remove
the comment before the third logging statement, the exception occurs
there already - also caught in the second block - that leads me to
believe that something with the passed-in myid is up.
Any ideas?
Thanks!
def vote(request, myid):
logging.debug("Received request for myid:"+myid)
if request.method == u'POST':
POST = request.POST
if POST.has_key(u'rating'):
try:
score = POST[u'rating']
logging.debug("parameter rating:"+score+" id: ["+myid
+"]")
#logging.debug("Info:"+str(myid)+dir(myid))
v = Video.objects.get_or_create(pk = myid)
logging.debug("Video:"+v.id)
v.votes += 1
v.all_scores += score
v.score = v.votes / v.all_scores
except (RuntimeError, TypeError, NameError ):
logging.debug("Caught exception:"+type(inst))
logging.debug(" args:"+inst.args+ " inst:"+inst)
except :
logging.debug("Caught exception:")
raise
output:
[16/Sep/2008 22:40:21] "GET /site_media/img/stars.gif HTTP/1.1" 304 0
2008-09-16 22:40:21,820 DEBUG Received request for my_id:1
2008-09-16 22:40:21,820 DEBUG parameter rating:0.86 id: [1]
[16/Sep/2008 22:40:21] "POST /video/1/vote/ HTTP/1.1" 500 52331
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---