(self, key='author')
| 1320 | context['contributors'][-1][key] = value |
| 1321 | |
| 1322 | def _sync_author_detail(self, key='author'): |
| 1323 | context = self._getContext() |
| 1324 | detail = context.get('%s_detail' % key) |
| 1325 | if detail: |
| 1326 | name = detail.get('name') |
| 1327 | email = detail.get('email') |
| 1328 | if name and email: |
| 1329 | context[key] = u'%s (%s)' % (name, email) |
| 1330 | elif name: |
| 1331 | context[key] = name |
| 1332 | elif email: |
| 1333 | context[key] = email |
| 1334 | else: |
| 1335 | author, email = context.get(key), None |
| 1336 | if not author: |
| 1337 | return |
| 1338 | emailmatch = re.search(ur'''(([a-zA-Z0-9\_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?))(\?subject=\S+)?''', author) |
| 1339 | if emailmatch: |
| 1340 | email = emailmatch.group(0) |
| 1341 | # probably a better way to do the following, but it passes all the tests |
| 1342 | author = author.replace(email, u'') |
| 1343 | author = author.replace(u'()', u'') |
| 1344 | author = author.replace(u'<>', u'') |
| 1345 | author = author.replace(u'<>', u'') |
| 1346 | author = author.strip() |
| 1347 | if author and (author[0] == u'('): |
| 1348 | author = author[1:] |
| 1349 | if author and (author[-1] == u')'): |
| 1350 | author = author[:-1] |
| 1351 | author = author.strip() |
| 1352 | if author or email: |
| 1353 | context.setdefault('%s_detail' % key, FeedParserDict()) |
| 1354 | if author: |
| 1355 | context['%s_detail' % key]['name'] = author |
| 1356 | if email: |
| 1357 | context['%s_detail' % key]['email'] = email |
| 1358 | |
| 1359 | def _start_subtitle(self, attrsD): |
| 1360 | self.pushContent('subtitle', attrsD, u'text/plain', 1) |
no test coverage detected