Sorry for the trouble here: I pushed this to trunk: def rss(feed): if not 'entries' in feed and 'items' in feed: feed['entries'] = feed['items'] def safestr(obj, key, default=''): return str(obj[key]).encode('utf-8', 'replace') if key in obj else default
now = datetime.datetime.now() rss = rss2.RSS2(title=safestr(feed,'title'), link=safestr(feed,'link'), description=safestr(feed,'description'), lastBuildDate=feed.get('created_on', now), items=[rss2.RSSItem( title=safestr(entry,'title','(notitle)'), link=safestr(entry,'link'), description=safestr(entry,'description'), pubDate=entry.get('created_on', now) ) for entry in feed.get('entries', [])]) return rss.to_xml(encoding='utf-8') please let me know if this fixes it. If not, please send me more details about the feed you are trying to read. On Tuesday, 9 September 2014 00:45:25 UTC-5, Капылов Данил wrote: > > Does not work. :-) > > Error ticket for "welcome"Ticket ID > > 127.0.0.1.2014-09-09.11-33-31.6f78e65a-5d28-410e-9111-55ded191b520 > <type 'exceptions.AttributeError'> 'NoneType' object has no attribute > 'encode'Версияweb2py™Version 2.9.9-stable+timestamp.2014.09.08.13.16.54 > PythonPython 2.7.6: C:\Python27\python.exe (prefix: C:\Python27)Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > > Traceback (most recent call last): > File > "C:\Users\�����\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\restricted.py", > line 221, in restricted > exec ccode in environment > File > "C:\Users\�����\Documents\MEGAsync\Web2pyProject\Ad\web2py\applications\welcome\views\generic.rss", > line 10, in <module> > from gluon.serializers import rss}}{{=XML(rss(response._vars))}} > File > "C:\Users\�����\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\serializers.py", > line 168, in rss > link=str((feed.get('link') or '').encode('utf-8', 'replace')), > AttributeError: 'NoneType' object has no attribute 'encode' > > Error snapshot [image: help] > <http://127.0.0.1:8000/admin/default/ticket/welcome/127.0.0.1.2014-09-09.11-33-31.6f78e65a-5d28-410e-9111-55ded191b520#> > > <type 'exceptions.AttributeError'>('NoneType' object has no attribute > 'encode') > > inspect attributes > Frames > > - > > *File > > C:\Users\�����\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\restricted.py > in restricted at line 221* код аргументы переменные > - > > *File > > C:\Users\�����\Documents\MEGAsync\Web2pyProject\Ad\web2py\applications\welcome\views\generic.rss > > in <module> at line 10* код аргументы переменные > - > > *File > > C:\Users\�����\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\serializers.py > > in rss at line 168* код аргументы переменные > Function argument list > > (feed={'message': <lazyT 'Hello World'>}) > Code listing > > 163. > 164. > 165. > 166. > 167. > 168. > > 169. > 170. > 171.<span style="color: > > > ... -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.