Re: Problem when using RAW SQL Query with Django (not all arguments converted during string formatting)
Thank you, that work fine ! On 9 jan, 05:59, "Karen Tracey" wrote: > On Thu, Jan 8, 2009 at 11:41 PM, Kedare wrote: > > > Hi, i have made a Cache management Page for Django, but i have a > > problem, i need to expire single cache entries, so i made this : > > > (the url is like that by example: "/admin/cache_management/? > > > action=clear&key=views.decorators.cache.cache_page../.d41d8cd98f00b204e9800998ecf8427e") > > > if request.GET.get("action","") == "clear": > > entry = request.GET.get("key","") > > cursor.execute("""DELETE FROM django_cache" WHERE cache_key > > = %s""", > > (entry)) > > Just a guess, but I think you may be missing a comma after entry here. > Single-element tuples need trailing commas after the single element in order > to make them tuples. > > > > > cursor.execute("COMMIT") > > message = _("Cache entry %s deleted" % (entry)) > > > But i get this error, i don't know why : > > TypeError at /admin/cache_management/ > > not all arguments converted during string formatting > > > I don't think my query have a problem, i use anothers query on the > > same view (with %s too), and i don't have any problems > > > I am using Postgresql with psycopg2 > > > Any ideas on my problem ? > > Thank and happy new year > > Sorry for my bad english :) --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem when using RAW SQL Query with Django (not all arguments converted during string formatting)
On Thu, Jan 8, 2009 at 11:41 PM, Kedare wrote: > > Hi, i have made a Cache management Page for Django, but i have a > problem, i need to expire single cache entries, so i made this : > > (the url is like that by example: "/admin/cache_management/? > > action=clear&key=views.decorators.cache.cache_page../.d41d8cd98f00b204e9800998ecf8427e") > >if request.GET.get("action","") == "clear": >entry = request.GET.get("key","") >cursor.execute("""DELETE FROM django_cache" WHERE cache_key > = %s""", > (entry)) Just a guess, but I think you may be missing a comma after entry here. Single-element tuples need trailing commas after the single element in order to make them tuples. > >cursor.execute("COMMIT") >message = _("Cache entry %s deleted" % (entry)) > > But i get this error, i don't know why : > TypeError at /admin/cache_management/ > not all arguments converted during string formatting > > I don't think my query have a problem, i use anothers query on the > same view (with %s too), and i don't have any problems > > I am using Postgresql with psycopg2 > > Any ideas on my problem ? > Thank and happy new year > Sorry for my bad english :) > > > > --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem when using RAW SQL Query with Django (not all arguments converted during string formatting)
Hi, i have made a Cache management Page for Django, but i have a problem, i need to expire single cache entries, so i made this : (the url is like that by example: "/admin/cache_management/? action=clear&key=views.decorators.cache.cache_page../.d41d8cd98f00b204e9800998ecf8427e") if request.GET.get("action","") == "clear": entry = request.GET.get("key","") cursor.execute("""DELETE FROM django_cache" WHERE cache_key = %s""", (entry)) cursor.execute("COMMIT") message = _("Cache entry %s deleted" % (entry)) But i get this error, i don't know why : TypeError at /admin/cache_management/ not all arguments converted during string formatting I don't think my query have a problem, i use anothers query on the same view (with %s too), and i don't have any problems I am using Postgresql with psycopg2 Any ideas on my problem ? Thank and happy new year Sorry for my bad english :) --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---