From aea54b214ab45ccfa37098e3b0af12f4585d9f63 Mon Sep 17 00:00:00 2001 From: ianb Date: Tue, 28 Feb 2006 20:38:53 +0000 Subject: Added a location method to redirect exceptions --- paste/httpexceptions.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'paste/httpexceptions.py') diff --git a/paste/httpexceptions.py b/paste/httpexceptions.py index 4f2f366..9952b68 100644 --- a/paste/httpexceptions.py +++ b/paste/httpexceptions.py @@ -326,6 +326,13 @@ class _HTTPMove(HTTPRedirection): relative_redirect = classmethod(relative_redirect) + def location(self): + for name, value in self.headers: + if name.lower() == 'location': + return value + else: + raise KeyError("No location set for %s" % self) + class HTTPMultipleChoices(_HTTPMove): code = 300 title = 'Multiple Choices' -- cgit v1.2.1