Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Łukasz Rekucki
>> returns http.HttpResponseForbidden which is almost never what you actually >> want to return to the user > > that's not true, at least no more than a 404/500 which you also return and > have templates for; 403 is a perfectly valid response in fact django's trac > uses it too via apache auth and

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Michael Cetrulo
> > Also, it's not really documented anywhere and because it's outside of http > module, it's hard to find on your own. > bingo, that's exactly the point and that's why a more intuitive and expected Http403 would be nice, you will know where to find it and you will know what it's supposed to do.

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Felipe Prenholato
Hello. I wrote the http://chronosbox.org/blog/manipulando-erros-http-403-permissao-negada-no-django?lang=en .. at time that I did it I don't know about django.core.exceptions.PermissionDenied, but it can be used at Http403Middleware. The real idea behind this code is allow developers at company, wr

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Łukasz Rekucki
On 28 June 2010 18:17, Tom Evans wrote: > On Mon, Jun 28, 2010 at 5:13 PM, Michael Cetrulo wrote: >> that's incorrect, we're talking about exceptions that go back as status >> codes not internals for the application itself. >> > > django.core.exceptions.PermissionDenied is caught by > BaseHandler

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Michael Cetrulo
as I've said, that isn't http module; an Http403 would be nice. On Mon, Jun 28, 2010 at 1:17 PM, Tom Evans wrote: > On Mon, Jun 28, 2010 at 5:13 PM, Michael Cetrulo > wrote: > > that's incorrect, we're talking about exceptions that go back as status > > codes not internals for the application i

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Tom Evans
On Mon, Jun 28, 2010 at 5:13 PM, Michael Cetrulo wrote: > that's incorrect, we're talking about exceptions that go back as status > codes not internals for the application itself. > django.core.exceptions.PermissionDenied is caught by BaseHandler::get_response() and converts it into a HttpRespons

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Michael Cetrulo
now I find odd that it might get translated to that, since it's a different location than http module On Mon, Jun 28, 2010 at 1:13 PM, Michael Cetrulo wrote: > that's incorrect, we're talking about exceptions that go back as status > codes not internals for the application itself. > > > On Mon, J

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Michael Cetrulo
that's incorrect, we're talking about exceptions that go back as status codes not internals for the application itself. On Mon, Jun 28, 2010 at 1:07 PM, Rybarczyk Tomasz wrote: > > Http403 would be nice too. > > raise django.core.exceptions.PermissionDenied > > Best regards, > paluh > > 2010/6/2

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Rybarczyk Tomasz
> Http403 would be nice too. raise django.core.exceptions.PermissionDenied Best regards, paluh 2010/6/28 Michael Cetrulo : > Http403 would be nice too. > > http://chronosbox.org/blog/manipulando-erros-http-403-permissao-negada-no-django?lang=en > http://theglenbot.com/creating-a-custom-http403-e

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Michael Cetrulo
Http403 would be nice too. http://chronosbox.org/blog/manipulando-erros-http-403-permissao-negada-no-django?lang=en http://theglenbot.com/creating-a-custom-http403-exception-in-django http://groups.google.com/group/django-users/browse_thread/thread/8d3dda89858ff2ee On Mon, Jun 28, 2010 at 12:36 P

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Gabriel Hurley
Http301 doesn't seem entirely correct to me, however I have found use for an Http302/HttpLoginRedirect exception that can be raised from anywhere to handle unauthorized users. If your authorization process is handled somewhere other than directly in a view or decorator (like in a manager that chec

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Patryk Zawadzki
On Mon, Jun 28, 2010 at 12:07 PM, kernel1983 wrote: > There is exception Http404 in the system. > > During django programming, we often need to do some data valid: > > def A(request): >    valid() >    return render_to_response(...) > > def B(request): >    valid() >    return render_to_response(.

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Felipe Prenholato
-1 ... IMO that's a change that we really don't need :), and isn't hard to implement if developer prefer 'exceptions' way. 2010/6/28 Sergej dergatsjev eecho > -1 > > 2010/6/28 kernel1983 : > > There is exception Http404 in the system. > > > > During django programming, we often need to do some d

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Sergej dergatsjev eecho
-1 2010/6/28 kernel1983 : > There is exception Http404 in the system. > > During django programming, we often need to do some data valid: > > def A(request): >    valid() >    return render_to_response(...) > > def B(request): >    valid() >    return render_to_response(...) > ... > > def valid():

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Russell Keith-Magee
On Mon, Jun 28, 2010 at 6:07 PM, kernel1983 wrote: > There is exception Http404 in the system. Yes - because a 404 is an error that shouldn't normally occur. Hence, an exception is an appropriate way to raise the alarm. However, a 301 is a valid response indicating that the content is elsewhere.

Re: Suggestion of exception Http301 add as new feature

2010-06-28 Thread Łukasz Rekucki
On 28 June 2010 12:07, kernel1983 wrote: > There is exception Http404 in the system. > > During django programming, we often need to do some data valid: > > def A(request): >    valid() >    return render_to_response(...) > > def B(request): >    valid() >    return render_to_response(...) > ... >

Suggestion of exception Http301 add as new feature

2010-06-28 Thread kernel1983
There is exception Http404 in the system. During django programming, we often need to do some data valid: def A(request): valid() return render_to_response(...) def B(request): valid() return render_to_response(...) ... def valid(): throw Http301(url) With Http301 exception