Changeset 391 for python/trunk/Lib/email/_parseaddr.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/email/_parseaddr.py
r2 r391 14 14 ] 15 15 16 import time 16 import time, calendar 17 17 18 18 SPACE = ' ' … … 108 108 except ValueError: 109 109 return None 110 # Check for a yy specified in two-digit format, then convert it to the 111 # appropriate four-digit format, according to the POSIX standard. RFC 822 112 # calls for a two-digit yy, but RFC 2822 (which obsoletes RFC 822) 113 # mandates a 4-digit yy. For more information, see the documentation for 114 # the time module. 115 if yy < 100: 116 # The year is between 1969 and 1999 (inclusive). 117 if yy > 68: 118 yy += 1900 119 # The year is between 2000 and 2068 (inclusive). 120 else: 121 yy += 2000 110 122 tzoffset = None 111 123 tz = tz.upper() … … 139 151 140 152 def mktime_tz(data): 141 """Turn a 10-tuple as returned by parsedate_tz() into a UTCtimestamp."""153 """Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.""" 142 154 if data[9] is None: 143 155 # No zone info, so localtime is better assumption than GMT 144 156 return time.mktime(data[:8] + (-1,)) 145 157 else: 146 t = time.mktime(data[:8] + (0,))147 return t - data[9] - time.timezone158 t = calendar.timegm(data) 159 return t - data[9] 148 160 149 161 150 162 def quote(str): 151 """Add quotes around a string.""" 163 """Prepare string to be used in a quoted string. 164 165 Turns backslash and double quote characters into quoted pairs. These 166 are the only characters that need to be quoted inside a quoted string. 167 Does not add the surrounding double quotes. 168 """ 152 169 return str.replace('\\', '\\\\').replace('"', '\\"') 153 170 … … 307 324 self.pos += 1 308 325 elif self.field[self.pos] == '"': 309 aslist.append('"%s"' % self.getquote())326 aslist.append('"%s"' % quote(self.getquote())) 310 327 elif self.field[self.pos] in self.atomends: 311 328 break
Note:
See TracChangeset
for help on using the changeset viewer.