Changeset 3410
- Timestamp:
- 07/21/06 11:20:22 (2 years ago)
- Files:
-
- django/trunk/django/contrib/admin/views/doc.py (modified) (1 diff)
- django/trunk/django/core/handlers/modpython.py (modified) (1 diff)
- django/trunk/django/core/handlers/wsgi.py (modified) (2 diffs)
- django/trunk/django/http/__init__.py (modified) (2 diffs)
- django/trunk/django/middleware/common.py (modified) (2 diffs)
- django/trunk/django/views/debug.py (modified) (2 diffs)
- django/trunk/docs/request_response.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/admin/views/doc.py
r3284 r3410 29 29 admin_root = request.path[:-len('doc/bookmarklets/')] 30 30 return render_to_response('admin_doc/bookmarklets.html', { 31 'admin_url': "%s://%s%s" % ( os.environ.get('HTTPS') == 'on'and 'https' or 'http', get_host(request), admin_root),31 'admin_url': "%s://%s%s" % (request.is_secure() and 'https' or 'http', get_host(request), admin_root), 32 32 }, context_instance=RequestContext(request)) 33 33 bookmarklets = staff_member_required(bookmarklets) django/trunk/django/core/handlers/modpython.py
r3164 r3410 23 23 def get_full_path(self): 24 24 return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '') 25 26 def is_secure(self): 27 return self._req.subprocess_env.has_key('HTTPS') and self._req.subprocess_env['HTTPS'] == 'on' 25 28 26 29 def _load_post_and_files(self): django/trunk/django/core/handlers/wsgi.py
r3393 r3410 55 55 self.environ = environ 56 56 self.path = environ['PATH_INFO'] 57 self.META = environ 57 self.META = environ 58 58 self.method = environ['REQUEST_METHOD'].upper() 59 59 … … 66 66 def get_full_path(self): 67 67 return '%s%s' % (self.path, self.environ.get('QUERY_STRING', '') and ('?' + self.environ.get('QUERY_STRING', '')) or '') 68 69 def is_secure(self): 70 return self.environ.has_key('HTTPS') and self.environ['HTTPS'] == 'on' 68 71 69 72 def _load_post_and_files(self): django/trunk/django/http/__init__.py
r3166 r3410 1 import os 1 2 from Cookie import SimpleCookie 2 3 from pprint import pformat … … 38 39 def get_full_path(self): 39 40 return '' 41 42 def is_secure(self): 43 return os.environ.get("HTTPS") == "on" 40 44 41 45 def parse_file_upload(header_dict, post_data): django/trunk/django/middleware/common.py
r3171 r3410 2 2 from django import http 3 3 from django.core.mail import mail_managers 4 import md5 , os4 import md5 5 5 6 6 class CommonMiddleware(object): … … 45 45 # Redirect 46 46 if new_url[0]: 47 newurl = "%s://%s%s" % ( os.environ.get('HTTPS') == 'on'and 'https' or 'http', new_url[0], new_url[1])47 newurl = "%s://%s%s" % (request.is_secure() and 'https' or 'http', new_url[0], new_url[1]) 48 48 else: 49 49 newurl = new_url[1] django/trunk/django/views/debug.py
r3127 r3410 125 125 'lastframe': frames[-1], 126 126 'request': request, 127 'request_protocol': os.environ.get("HTTPS") == "on"and "https" or "http",127 'request_protocol': request.is_secure() and "https" or "http", 128 128 'settings': get_safe_settings(), 129 129 'template_info': template_info, … … 150 150 'reason': str(exception), 151 151 'request': request, 152 'request_protocol': os.environ.get("HTTPS") == "on"and "https" or "http",152 'request_protocol': request.is_secure() and "https" or "http", 153 153 'settings': get_safe_settings(), 154 154 }) django/trunk/docs/request_response.txt
r3360 r3410 135 135 136 136 ``__getitem__(key)`` 137 Returns the GET/POST value for the given key, checking POST first, then138 GET. Raises ``KeyError`` if the key doesn't exist.139 140 This lets you use dictionary-accessing syntax on an ``HttpRequest``141 instance. Example: ``request["foo"]`` would return ``True`` if either142 ``request.POST`` or ``request.GET`` had a ``"foo"`` key.137 Returns the GET/POST value for the given key, checking POST first, then 138 GET. Raises ``KeyError`` if the key doesn't exist. 139 140 This lets you use dictionary-accessing syntax on an ``HttpRequest`` 141 instance. Example: ``request["foo"]`` would return ``True`` if either 142 ``request.POST`` or ``request.GET`` had a ``"foo"`` key. 143 143 144 144 ``has_key()`` 145 Returns ``True`` or ``False``, designating whether ``request.GET`` or146 ``request.POST`` has the given key.145 Returns ``True`` or ``False``, designating whether ``request.GET`` or 146 ``request.POST`` has the given key. 147 147 148 148 ``get_full_path()`` 149 Returns the ``path``, plus an appended query string, if applicable. 150 151 Example: ``"/music/bands/the_beatles/?print=true"`` 149 Returns the ``path``, plus an appended query string, if applicable. 150 151 Example: ``"/music/bands/the_beatles/?print=true"`` 152 153 ``is_secure()`` 154 Returns ``True`` if the request is secure; that is, if it was made with 155 HTTPS. 152 156 153 157 QueryDict objects
