Looks very wrong

link=str(feed.get('link', None).encode('utf-8', 'replace')),

*should be*

 link=str(feed.get('link', '').encode('utf-8', 'replace')),

On Sunday, 7 September 2014 12:01:10 UTC-5, Капылов Данил wrote:
>
> <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 
> 'encode'
> *Version *
> web2py™Version 2.9.8-stable+timestamp.2014.09.07.04.13.28PythonPython 
> 2.7.5+: /usr/local/bin/uwsgi (prefix: /usr)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
>   File "/home/Danilka88/web2py/gluon/restricted.py", line 221, in restricted
>     exec ccode in environment
>   File "/home/Danilka88/web2py/applications/agro/views/generic.rss", line 10, 
> in <module>
>     from gluon.serializers import rss}}{{=XML(rss(response._vars))}}
>   File "/home/Danilka88/web2py/gluon/serializers.py", line 168, in rss
>     link=str(feed.get('link', None).encode('utf-8', 'replace')),
> AttributeError: 'NoneType' object has no attribute 'encode'
>
>
> def rss(feed):
>     if not 'entries' in feed and 'items' in feed:
>         feed['entries'] = feed['items']
>     now = datetime.datetime.now()
>     rss = rss2.RSS2(title=str(feed.get('title', '(notitle)').encode('utf-8', 
> 'replace')),
>                     link=str(feed.get('link', None).encode('utf-8', 
> 'replace')),
>
>                     description=str(feed.get('description', 
> '').encode('utf-8', 'replace')),
>                     lastBuildDate=feed.get('created_on', now),
>                     items=[rss2.RSSItem(
>                            title=str(entry.get('title', 
> '(notitle)').encode('utf-8', 'replace')),
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to