| 80 | | link = add_domain(current_site.domain, self.__get_dynamic_attr('item_link', item)) |
|---|
| 81 | | enc = None |
|---|
| 82 | | enc_url = self.__get_dynamic_attr('item_enclosure_url', item) |
|---|
| 83 | | if enc_url: |
|---|
| 84 | | enc = feedgenerator.Enclosure( |
|---|
| 85 | | url = enc_url.decode('utf-8'), |
|---|
| 86 | | length = str(self.__get_dynamic_attr('item_enclosure_length', item)).decode('utf-8'), |
|---|
| 87 | | mime_type = self.__get_dynamic_attr('item_enclosure_mime_type', item).decode('utf-8'), |
|---|
| | 80 | try: |
|---|
| | 81 | link = add_domain(current_site.domain, self.__get_dynamic_attr('item_link', item)) |
|---|
| | 82 | enc = None |
|---|
| | 83 | enc_url = self.__get_dynamic_attr('item_enclosure_url', item) |
|---|
| | 84 | if enc_url: |
|---|
| | 85 | enc = feedgenerator.Enclosure( |
|---|
| | 86 | url = enc_url.decode('utf-8'), |
|---|
| | 87 | length = str(self.__get_dynamic_attr('item_enclosure_length', item)).decode('utf-8'), |
|---|
| | 88 | mime_type = self.__get_dynamic_attr('item_enclosure_mime_type', item).decode('utf-8'), |
|---|
| | 89 | ) |
|---|
| | 90 | author_name = self.__get_dynamic_attr('item_author_name', item) |
|---|
| | 91 | if author_name is not None: |
|---|
| | 92 | author_email = self.__get_dynamic_attr('item_author_email', item) |
|---|
| | 93 | author_link = self.__get_dynamic_attr('item_author_link', item) |
|---|
| | 94 | else: |
|---|
| | 95 | author_email = author_link = None |
|---|
| | 96 | feed.add_item( |
|---|
| | 97 | title = title_template.render(Context({'obj': item, 'site': current_site})).decode('utf-8'), |
|---|
| | 98 | link = link, |
|---|
| | 99 | description = description_template.render(Context({'obj': item, 'site': current_site})).decode('utf-8'), |
|---|
| | 100 | unique_id = link, |
|---|
| | 101 | enclosure = enc, |
|---|
| | 102 | pubdate = self.__get_dynamic_attr('item_pubdate', item), |
|---|
| | 103 | author_name = author_name, |
|---|
| | 104 | author_email = author_email, |
|---|
| | 105 | author_link = author_link, |
|---|
| 89 | | author_name = self.__get_dynamic_attr('item_author_name', item) |
|---|
| 90 | | if author_name is not None: |
|---|
| 91 | | author_email = self.__get_dynamic_attr('item_author_email', item) |
|---|
| 92 | | author_link = self.__get_dynamic_attr('item_author_link', item) |
|---|
| 93 | | else: |
|---|
| 94 | | author_email = author_link = None |
|---|
| 95 | | feed.add_item( |
|---|
| 96 | | title = title_template.render(Context({'obj': item, 'site': current_site})).decode('utf-8'), |
|---|
| 97 | | link = link, |
|---|
| 98 | | description = description_template.render(Context({'obj': item, 'site': current_site})).decode('utf-8'), |
|---|
| 99 | | unique_id = link, |
|---|
| 100 | | enclosure = enc, |
|---|
| 101 | | pubdate = self.__get_dynamic_attr('item_pubdate', item), |
|---|
| 102 | | author_name = author_name, |
|---|
| 103 | | author_email = author_email, |
|---|
| 104 | | author_link = author_link, |
|---|
| 105 | | ) |
|---|
| | 107 | except UnicodeDecodeError: |
|---|
| | 108 | pass |
|---|