Read a single mime.types-format file. If strict is true, information will be added to list of standard types, else to the list of non-standard types.
(self, fp, strict=True)
| 248 | self.readfp(fp, strict) |
| 249 | |
| 250 | def readfp(self, fp, strict=True): |
| 251 | """ |
| 252 | Read a single mime.types-format file. |
| 253 | |
| 254 | If strict is true, information will be added to |
| 255 | list of standard types, else to the list of non-standard |
| 256 | types. |
| 257 | """ |
| 258 | while line := fp.readline(): |
| 259 | words = line.split() |
| 260 | for i in range(len(words)): |
| 261 | if words[i][0] == '#': |
| 262 | del words[i:] |
| 263 | break |
| 264 | if not words: |
| 265 | continue |
| 266 | type, suffixes = words[0], words[1:] |
| 267 | for suff in suffixes: |
| 268 | self.add_type(type, '.' + suff, strict) |
| 269 | |
| 270 | def read_windows_registry(self, strict=True): |
| 271 | """ |