summaryrefslogtreecommitdiff
path: root/paste/wsgiwrappers.py
diff options
context:
space:
mode:
authorbbangert <devnull@localhost>2006-08-20 23:44:43 +0000
committerbbangert <devnull@localhost>2006-08-20 23:44:43 +0000
commitda2ad3ee1f8388c5c3f31dec3c47a1fd68faa8fa (patch)
treec8879f63caaac7a5f27a36308b48b5872250e250 /paste/wsgiwrappers.py
parent4b4cc4898e0bea85ba5ff43000a1dd2b373aa843 (diff)
downloadpaste-da2ad3ee1f8388c5c3f31dec3c47a1fd68faa8fa.tar.gz
Changed request.xhr to request.is_xhr which is a bool function thats true if X-Requested-With is present and equal to XMLHttpRequest.
Diffstat (limited to 'paste/wsgiwrappers.py')
-rw-r--r--paste/wsgiwrappers.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/paste/wsgiwrappers.py b/paste/wsgiwrappers.py
index 660c79d..79cb8a6 100644
--- a/paste/wsgiwrappers.py
+++ b/paste/wsgiwrappers.py
@@ -57,7 +57,11 @@ class WSGIRequest(object):
script_name = environ_getter('SCRIPT_NAME')
path_info = environ_getter('PATH_INFO')
urlvars = environ_getter('paste.urlvars', default_factory=dict)
- xhr = environ_getter('X-Requested-With', default=False)
+
+ def is_xhr(self):
+ """Returns a boolean if X-Requested-With is present and a XMLHttpRequest"""
+ return self.environ.get('X-Requested-With', '') == 'XMLHttpRequest'
+ is_xhr = property(is_xhr, doc=is_xhr.__doc__)
def host(self):
"""Host name provided in HTTP_HOST, with fall-back to SERVER_NAME"""