Hello all,
Am I the only one having issues with generic RSS views? Is there any
workaround for my problem?
Thank you
Le dimanche 2 juin 2013 14:16:25 UTC+2, Loïc a écrit :
>
> Well,
>
> I replaced python27/lib/xml/sax/*saxutils.py *with the patched file (see
> attached)
> But I still have the same error :
> Ticket ID
>
> 127.0.0.1.2013-06-02.14-13-25.c9feb7ca-4163-463e-ad44-185a7141dc9d
> <type 'exceptions.UnicodeDecodeError'> 'ascii' codec can't decode byte
> 0xc3 in position 9: ordinal not in range(128)Versionweb2py™Version
> 2.4.7-stable+timestamp.2013.05.24.17.48.47PythonPython 2.7.5:
> C:\Python27\python.exe (prefix: C:\Python27)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
> File "D:\Google Drive\loic\web2py\web2py\gluon\restricted.py", line 212, in
> restricted
> exec ccode in environment
> File "D:\Google
> Drive\loic\web2py\web2py\applications\dommartin25\views\generic.rss", line
> 10, in <module>
> from gluon.serializers import rss}}{{=XML(rss(response._vars))}}
> File "D:\Google Drive\loic\web2py\web2py\gluon\serializers.py", line 174,
> in rss
> ) for entry in feed.get('entries', [])])
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9:
> ordinal not in range(128)
>
>
> Any idea?
> Thank you
>
>
> Le vendredi 31 mai 2013 12:30:34 UTC+2, Loïc a écrit :
>>
>> Sorry but I installed latest python version on my laptop (python 2.7.5 on
>> Win7 x64) and it still doesn't work :
>>
>> <type 'exceptions.UnicodeDecodeError'> 'ascii' codec can't decode byte
>> 0xc3 in position 9: ordinal not in range(128)
>> Versionweb2py™Version 2.4.7-stable+timestamp.2013.05.24.17.48.47PythonPython
>> 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>>
>> Traceback (most recent call last):
>> File "D:\Google Drive\loic\web2py\web2py\gluon\restricted.py", line 212,
>> in restricted
>> exec ccode in environment
>> File "D:\Google
>> Drive\loic\web2py\web2py\applications\dommartin25\views\generic.rss", line
>> 10, in <module>
>> from gluon.serializers import rss}}{{=XML(rss(response._vars))}}
>> File "D:\Google Drive\loic\web2py\web2py\gluon\serializers.py", line 174,
>> in rss
>> ) for entry in feed.get('entries', [])])
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9:
>> ordinal not in range(128)
>>
>>
>>
>> I'm not a "python-master" like you, Niphlod and Sebastian, but would it
>> be possible to make something like below in order not to break backward
>> compatibility when one updates Web2py 2.4.5 to 2.4.7?
>> *in seriaizers.py (this code doesn't work, it is just to explain my
>> idea...)*
>> *
>> def rss(feed):
>> if not 'entries' in feed and 'items' in feed:
>> feed['entries'] = feed['items']
>> now = datetime.datetime.now()
>> try:
>> 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')),
>> link=str(entry.get('link', None).encode(
>> 'utf-8', 'replace')),
>> description=str(entry.get('description',
>> '').encode('utf-8', 'replace')),
>> pubDate=entry.get('created_on', now)
>> ) for entry in feed.get('entries', [])])
>> except Exception: #if an exception is raised, we use the former
>> methon which works fine
>> rss = rss2.RSS2(title=str(feed.get('title', '(notitle)')),
>> link=str(feed.get('link', None)),
>> description=str(feed.get('description', '')),
>> lastBuildDate=feed.get('created_on', now),
>> items=[rss2.RSSItem(
>> title=str(entry.get('title', '(notitle)'
>> )),
>> link=str(entry.get('link', None)),
>> description=str(entry.get('description',
>> '')),
>> pubDate=entry.get('created_on', now)
>> ) for entry in feed.get('entries', [])])
>> return rss.to_xml(encoding='utf-8')
>>
>> *
>>
>> Thank you
>>
>> Le jeudi 30 mai 2013 23:09:53 UTC+2, Sebastian Ortiz Vasquez a écrit :
>>>
>>> Is not mandatory, is enough appling the patch described above to the
>>> sax_parser.
>>>
>>>
>>> On Thu, May 30, 2013 at 4:08 PM, Loïc ESPERN <[email protected]> wrote:
>>>
>>>> I'm currently using python 2.7.3
>>>> Should I update to the latest 2.7.5 to get this work ?
>>>> Le 30 mai 2013 21:57, "Sebastian Ortiz Vasquez" <[email protected]> a
>>>> écrit :
>>>>
>>>> Hi,
>>>>>
>>>>> Yes, in order to get this working, you should also update your cpython
>>>>> distribution, check the bug here
>>>>>
>>>>> http://bugs.python.org/issue17606
>>>>>
>>>>> On Wednesday, May 29, 2013 8:06:07 AM UTC-5, Loïc wrote:
>>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> It seems that the fix for issue 1422 introduced a bug on generic rss
>>>>>> views.
>>>>>> History :
>>>>>> https://github.com/web2py/**web2py/commit/**
>>>>>> ea34d1b3a02223e3032d91ad9269d7**0dcfd5f0b6#gluon/serializers.**py<https://github.com/web2py/web2py/commit/ea34d1b3a02223e3032d91ad9269d70dcfd5f0b6#gluon/serializers.py>
>>>>>>
>>>>>> *First error :*
>>>>>> On* gluon/serializers.py, line 166 *if feed.get() returns *None *we
>>>>>> can't call *.encode()* The following error is raised :
>>>>>>
>>>>>> Error ticket for "udsp25" Ticket ID
>>>>>>
>>>>>> 127.0.0.1.2013-05-29.14-41-05.**3b4f5f26-486e-4094-b32e-**
>>>>>> 838d2bedd4e5
>>>>>> <type 'exceptions.AttributeError'> 'NoneType' object has no attribute
>>>>>> 'encode' Version web2py™ Version 2.4.7-stable+timestamp.2013.**
>>>>>> 05.24.17.48.47 Python Python 2.7.3: 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\MCR\Google
>>>>>> Drive\loic\web2py\web2py\**gluon\restricted.py", line 212, in restricted
>>>>>>
>>>>>>
>>>>>> exec ccode in environment
>>>>>> File "C:\Users\MCR\Google
>>>>>> Drive\loic\web2py\web2py\**applications\udsp25\views\**generic.rss",
>>>>>> line 10, in <module>
>>>>>>
>>>>>>
>>>>>> from gluon.serializers import rss}}{{=XML(rss(response._vars**))}}
>>>>>>
>>>>>>
>>>>>> File "C:\Users\MCR\Google
>>>>>> Drive\loic\web2py\web2py\**gluon\serializers.py", line 166, in rss
>>>>>>
>>>>>>
>>>>>> link=str(feed.get('link', None).encode('utf-8', 'replace')),
>>>>>>
>>>>>> AttributeError: 'NoneType' object has no attribute 'encode'
>>>>>>
>>>>>>
>>>>>>
>>>>>> *Second error :*
>>>>>> On* gluon/serializers.py, line 174 *feed.get('entries', []) seems to
>>>>>> have an encoding problem...
>>>>>>
>>>>>> Error ticket for "dommartin25" Ticket ID
>>>>>>
>>>>>> 127.0.0.1.2013-05-29.14-49-25.**63d546c2-feb6-43e4-b6f2-**
>>>>>> 0cb4fc6bb022
>>>>>> <type 'exceptions.**UnicodeDecodeError'> 'ascii' codec can't decode
>>>>>> byte 0xc3 in position 9: ordinal not in range(128) Version web2py™
>>>>>> Version
>>>>>> 2.4.7-stable+timestamp.2013.**05.24.17.48.47 Python Python 2.7.3:
>>>>>> 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\MCR\Google
>>>>>> Drive\loic\web2py\web2py\**gluon\restricted.py", line 212, in restricted
>>>>>>
>>>>>>
>>>>>> exec ccode in environment
>>>>>> File "C:\Users\MCR\Google
>>>>>> Drive\loic\web2py\web2py\**applications\dommartin25\**views\generic.rss",
>>>>>> line 10, in <module>
>>>>>>
>>>>>>
>>>>>> from gluon.serializers import rss}}{{=XML(rss(response._vars**))}}
>>>>>>
>>>>>>
>>>>>> File "C:\Users\MCR\Google
>>>>>> Drive\loic\web2py\web2py\**gluon\serializers.py", line 174, in rss
>>>>>>
>>>>>>
>>>>>> ) for entry in feed.get('entries', [])])
>>>>>>
>>>>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9:
>>>>>> ordinal not in range(128)
>>>>>>
>>>>>>
>>>>>> Do you know how to fix it?
>>>>>> Thank you!
>>>>>>
>>>>> --
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "web2py-users" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/web2py/8ZwVMKS69Sg/unsubscribe?hl=en
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> [email protected].
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "web2py-users" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/web2py/8ZwVMKS69Sg/unsubscribe?hl=en.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Sebastián Ortiz Vásquez.
>>> 2013
>>>
>>
--
---
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/groups/opt_out.