On Jan 13, 12:17 pm, Nicolas Steinmetz <nsteinm...@gmail.com> wrote: > Hello, > > The following view works well with SQLite but since I switched to > PostgreSQL 8.3, I have the following error : > > ValueError at /start/ > The view start.views.index didn't return an HttpResponse object. > > Views is : > > def index(request): > """ > Try to see if there is a default theme to display. For the matching > case, get all category for the given theme and for each category, > display > related bookmarks > """ > default_theme=Theme.objects.filter(is_default=True) > if default_theme.count() is 1: > theme=Theme.objects.get(is_default=True) > return HttpResponseRedirect('%s' % theme.slug) > > Model is : > > class Theme(models.Model): > """ > A theme is a general point of view - within theme there would be > category > and within category, there will be bookmarks > """ > name = models.CharField(max_length=50) > slug = models.SlugField() > order = models.IntegerField() > is_default = models.BooleanField(default=False) > > class Meta: > ordering = ['order'] > verbose_name, verbose_name_plural = "Theme", "Themes" > > def __unicode__(self): > return self.name > > I do not understand wht it fails or why it is dependant on the SGBD. > Through the shell, the theme.slug is correct but I noticed that count() > answers me 1L for PGSQL and just 1 for SQLite - could it explain my issue ? > > Regards, > Nicolas
You're problem is you are testing identity with `is` when you want to test equality, which you should do with ==, this is likely causing the condition expect to pass to fail, and therefore your function returns None, which plainly isn't an HttpResponse object. Alex --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---