Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
(self)
| 493 | return EMPTYSTRING.join(atomlist) |
| 494 | |
| 495 | def getphraselist(self): |
| 496 | """Parse a sequence of RFC 2822 phrases. |
| 497 | |
| 498 | A phrase is a sequence of words, which are in turn either RFC 2822 |
| 499 | atoms or quoted-strings. Phrases are canonicalized by squeezing all |
| 500 | runs of continuous whitespace into one space. |
| 501 | """ |
| 502 | plist = [] |
| 503 | |
| 504 | while self.pos < len(self.field): |
| 505 | if self.field[self.pos] in self.FWS: |
| 506 | self.pos += 1 |
| 507 | elif self.field[self.pos] == '"': |
| 508 | plist.append(self.getquote()) |
| 509 | elif self.field[self.pos] == '(': |
| 510 | self.commentlist.append(self.getcomment()) |
| 511 | elif self.field[self.pos] in self.phraseends: |
| 512 | break |
| 513 | else: |
| 514 | plist.append(self.getatom(self.phraseends)) |
| 515 | |
| 516 | return plist |
| 517 | |
| 518 | class AddressList(AddrlistClass): |
| 519 | """An AddressList encapsulates a list of parsed RFC 2822 addresses.""" |
no test coverage detected