Wednesday, November 30, 2011

Re: A view associated with a lot of urls

>Probably not a problem. How are people ending up on those URLS? Not by
>guessing.

That's just the point here, to avoid crashing because some "smart"
people tried to play with urls. So with only a get or 404 there is no
way to know if the category/items does indeed exist or if the user
played with the url and gave a non existent category or category/
items. For example in one case we should display "No items in this
category" and in the other respond a 404 error page. That's why I'm
considering checking at the beginning of the view with a list/dict
filled with category names and one filled with item names to make sure
that the category is in the list/dict and same for the item before
hitting the database, and if not respond with a 404.


On Nov 30, 8:53 am, Reinout van Rees <rein...@vanrees.org> wrote:
> On 29-11-11 21:37, Nolhian wrote:
>
> > However with that, there is no way for example to make a difference
> > between "there is no items in this category" and "this category
> > doesn't exist" !
>
> Probably not a problem. How are people ending up on those URLS? Not by
> guessing, I think. So you probably have a start page that lists the
> categories and then a category page that lists the items.
>
> A 404 on /non/existing leads people to try /non/ which would also 404.
>
> Reinout
>
> --
> Reinout van Rees                    http://reinout.vanrees.org/
> rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"

--
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