Python django.utils.feedgenerator.Enclosure() Examples

The following are 7 code examples of django.utils.feedgenerator.Enclosure(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.utils.feedgenerator , or try the search function .
Example #1
Source File: views.py    From bioforum with MIT License 5 votes vote down vote up
def item_enclosures(self, item):
        enc_url = self._get_dynamic_attr('item_enclosure_url', item)
        if enc_url:
            enc = feedgenerator.Enclosure(
                url=str(enc_url),
                length=str(self._get_dynamic_attr('item_enclosure_length', item)),
                mime_type=str(self._get_dynamic_attr('item_enclosure_mime_type', item)),
            )
            return [enc]
        return [] 
Example #2
Source File: views.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def item_enclosures(self, item):
        enc_url = self._get_dynamic_attr('item_enclosure_url', item)
        if enc_url:
            enc = feedgenerator.Enclosure(
                url=str(enc_url),
                length=str(self._get_dynamic_attr('item_enclosure_length', item)),
                mime_type=str(self._get_dynamic_attr('item_enclosure_mime_type', item)),
            )
            return [enc]
        return [] 
Example #3
Source File: views.py    From python with Apache License 2.0 5 votes vote down vote up
def item_enclosures(self, item):
        enc_url = self._get_dynamic_attr('item_enclosure_url', item)
        if enc_url:
            enc = feedgenerator.Enclosure(
                url=force_text(enc_url),
                length=force_text(self._get_dynamic_attr('item_enclosure_length', item)),
                mime_type=force_text(self._get_dynamic_attr('item_enclosure_mime_type', item)),
            )
            return [enc]
        return [] 
Example #4
Source File: views.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def item_enclosures(self, item):
        enc_url = self.__get_dynamic_attr('item_enclosure_url', item)
        if enc_url:
            enc = feedgenerator.Enclosure(
                url=smart_text(enc_url),
                length=smart_text(self.__get_dynamic_attr('item_enclosure_length', item)),
                mime_type=smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item)),
            )
            return [enc]
        return [] 
Example #5
Source File: views.py    From python2017 with MIT License 5 votes vote down vote up
def item_enclosures(self, item):
        enc_url = self._get_dynamic_attr('item_enclosure_url', item)
        if enc_url:
            enc = feedgenerator.Enclosure(
                url=force_text(enc_url),
                length=force_text(self._get_dynamic_attr('item_enclosure_length', item)),
                mime_type=force_text(self._get_dynamic_attr('item_enclosure_mime_type', item)),
            )
            return [enc]
        return [] 
Example #6
Source File: feeds.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def item_enclosures(self, item):
        return [
            feedgenerator.Enclosure('http://example.com/hello.png', 0, 'image/png'),
            feedgenerator.Enclosure('http://example.com/goodbye.png', 0, 'image/png'),
        ] 
Example #7
Source File: feeds.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def item_enclosures(self, item):
        return [
            feedgenerator.Enclosure('http://example.com/hello.png', '0', 'image/png'),
            feedgenerator.Enclosure('http://example.com/goodbye.png', '0', 'image/png'),
        ]