Changeset 6656 for django/branches/newforms-admin/django/utils/http.py
- Timestamp:
- 11/06/07 16:25:59 (1 year ago)
- Files:
-
- django/branches/newforms-admin (modified) (1 prop)
- django/branches/newforms-admin/django/utils/http.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin
- Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-6612 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-6655
django/branches/newforms-admin/django/utils/http.py
r6613 r6656 1 1 import urllib 2 from email.Utils import formatdate 3 2 4 from django.utils.encoding import smart_str, force_unicode 3 5 from django.utils.functional import allow_lazy … … 38 40 doseq) 39 41 42 def cookie_date(epoch_seconds=None): 43 """ 44 Formats the time to ensure compatibility with Netscape's cookie standard. 45 46 Accepts a floating point number expressed in seconds since the epoch, in 47 UTC - such as that outputted by time.time(). If set to None, defaults to 48 the current time. 49 50 Outputs a string in the format 'Wdy, DD-Mon-YYYY HH:MM:SS GMT'. 51 """ 52 rfcdate = formatdate(epoch_seconds) 53 return '%s-%s-%s GMT' % (rfcdate[:7], rfcdate[8:11], rfcdate[12:25]) 54 55 def http_date(epoch_seconds=None): 56 """ 57 Formats the time to match the RFC1123 date format as specified by HTTP 58 RFC2616 section 3.3.1. 59 60 Accepts a floating point number expressed in seconds since the epoch, in 61 UTC - such as that outputted by time.time(). If set to None, defaults to 62 the current time. 63 64 Outputs a string in the format 'Wdy, DD Mon YYYY HH:MM:SS GMT'. 65 """ 66 rfcdate = formatdate(epoch_seconds) 67 return '%s GMT' % rfcdate[:25]
