Re: Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie

On Jul 6, 4:44 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-07-06 at 07:25 -0700, web-junkie wrote:
> > Thanks for your reply. I'll give more information:
>
> > #  c:\django_src\django\core\handlers\base.py in get_response
>
> >   77. response = callback(request, *callback_args,
> > **callback_kwargs) ...
>
> > # c:\django_src\django\contrib\syndication\views.py in feed
>
> >   19. feedgen = f(slug, request.path).get_feed(param) ...
>
> > # c:\django_src\django\contrib\syndication\feeds.py in get_feed
>
> >   81. feed_url = add_domain(current_site,
> > self.__get_dynamic_attr('feed_url', obj)), ...
>
> > # c:\django_src\django\contrib\syndication\feeds.py in add_domain
>
> >   13. url = u'http://%s%s' % (domain, url) ...
>
> > print repr(domain) and print repr(url) in add_comain produces
>
> > u'www.example.com'
> > '/gie%C3%9Fen/'
> > 
> > '/feeds/gie\xc3\x9fen/'
>
> And so we see the advantage of providing details about how a problem
> occurs. This makes things clear. :-)
>
> It's a bug. I'll fix it tomorrow morning because I'm doing something
> else right now and about to stop for the evening. Plus I want to think a
> bit about what the right approach is for cases like this -- possibly we
> should be converting request.path to an IRI portion when we construct
> the HttpRequest. Maybe not.
>
> No need to worry about opening a ticket. I've made a note and will look
> at it first thing.
>
> Regards,
> Malcolm
>
> --
> He who laughs last thinks slowest.http://www.pointy-stick.com/blog/- Hide 
> quoted text -
>
> - Show quoted text -

Great, thank you so much!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feeds don't work with Unicode URLs

2007-07-06 Thread Malcolm Tredinnick

On Fri, 2007-07-06 at 07:25 -0700, web-junkie wrote:
> Thanks for your reply. I'll give more information:
> 
> #  c:\django_src\django\core\handlers\base.py in get_response
> 
>   77. response = callback(request, *callback_args,
> **callback_kwargs) ...
> 
> # c:\django_src\django\contrib\syndication\views.py in feed
> 
>   19. feedgen = f(slug, request.path).get_feed(param) ...
> 
> # c:\django_src\django\contrib\syndication\feeds.py in get_feed
> 
>   81. feed_url = add_domain(current_site,
> self.__get_dynamic_attr('feed_url', obj)), ...
> 
> # c:\django_src\django\contrib\syndication\feeds.py in add_domain
> 
>   13. url = u'http://%s%s' % (domain, url) ...
> 
> print repr(domain) and print repr(url) in add_comain produces
> 
> u'www.example.com'
> '/gie%C3%9Fen/'
> 
> '/feeds/gie\xc3\x9fen/'

And so we see the advantage of providing details about how a problem
occurs. This makes things clear. :-)

It's a bug. I'll fix it tomorrow morning because I'm doing something
else right now and about to stop for the evening. Plus I want to think a
bit about what the right approach is for cases like this -- possibly we
should be converting request.path to an IRI portion when we construct
the HttpRequest. Maybe not.

No need to worry about opening a ticket. I've made a note and will look
at it first thing.

Regards,
Malcolm

-- 
He who laughs last thinks slowest. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie

Thanks for your reply. I'll give more information:

#  c:\django_src\django\core\handlers\base.py in get_response

  77. response = callback(request, *callback_args,
**callback_kwargs) ...

# c:\django_src\django\contrib\syndication\views.py in feed

  19. feedgen = f(slug, request.path).get_feed(param) ...

# c:\django_src\django\contrib\syndication\feeds.py in get_feed

  81. feed_url = add_domain(current_site,
self.__get_dynamic_attr('feed_url', obj)), ...

# c:\django_src\django\contrib\syndication\feeds.py in add_domain

  13. url = u'http://%s%s' % (domain, url) ...

print repr(domain) and print repr(url) in add_comain produces

u'www.example.com'
'/gie%C3%9Fen/'

'/feeds/gie\xc3\x9fen/'

You are right when you say that request.path is never passed directly
to add_domain, the error occurs when it uses feed_url.
feed_url is passed to the feed object from request.path

On Jul 6, 4:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-07-06 at 06:51 -0700, web-junkie wrote:
> > Hi, I have a problem of getting my feeds to work with unicode URLs.
>
> >  File "/usr/local/lib/python2.4/site-packages/django/contrib/
> > syndication/feeds.py", line 12, in add_domain
> >url = u'http://%s%s' % (domain, url)
>
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> > 19: ordinal not in range(128)
>
> You're only showing the last line of the traceback here. What is the
> full traceback? In particular, I would like to see which of the calls to
> add_domain() is triggering this.
>
> Can you also print out the values of "domain" and "url" inside that
> function -- or rather, print out repr(domain) and repr(url)? The easiest
> way to do this is change the source to catch UnicodeDecodeError in
> add_domain and then print out the values to sys.stderr and re-raise the
> exception.
>
>
>
> > In all my models I correctly encoded and quoted the URLs, I traced the
> > problem back to the request.path not being correctly quoted when it is
> > passed to the feed object.
>
> request.path is never passed directly to add_domain(), so it would help
> if you could explain this a little more. In particular, whenever
> add_domain() is called, it is using either the "link", "item_link" or
> "feed_url" attributes from your Feed class. If you can show us the code
> that is constructing each of those attributes, that would make things
> easier to work out what is going on.
>
>
>
> > There seems to be a bug or I'm doing something wrong, please help.
>
> It's not impossible that this is a bug, but you haven't given enough
> information to determine that. Show us the code that you've written to
> create these URLs and we should be able to get closer to a solution.
>
> Regards,
> Malcolm
>
> --
> The early bird may get the worm, but the second mouse gets the 
> cheese.http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feeds don't work with Unicode URLs

2007-07-06 Thread Malcolm Tredinnick

On Fri, 2007-07-06 at 06:51 -0700, web-junkie wrote:
> Hi, I have a problem of getting my feeds to work with unicode URLs.
> 
>  File "/usr/local/lib/python2.4/site-packages/django/contrib/
> syndication/feeds.py", line 12, in add_domain
>url = u'http://%s%s' % (domain, url)
> 
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 19: ordinal not in range(128)

You're only showing the last line of the traceback here. What is the
full traceback? In particular, I would like to see which of the calls to
add_domain() is triggering this.

Can you also print out the values of "domain" and "url" inside that
function -- or rather, print out repr(domain) and repr(url)? The easiest
way to do this is change the source to catch UnicodeDecodeError in
add_domain and then print out the values to sys.stderr and re-raise the
exception.

> 
> In all my models I correctly encoded and quoted the URLs, I traced the
> problem back to the request.path not being correctly quoted when it is
> passed to the feed object.

request.path is never passed directly to add_domain(), so it would help
if you could explain this a little more. In particular, whenever
add_domain() is called, it is using either the "link", "item_link" or
"feed_url" attributes from your Feed class. If you can show us the code
that is constructing each of those attributes, that would make things
easier to work out what is going on.
> 
> There seems to be a bug or I'm doing something wrong, please help.

It's not impossible that this is a bug, but you haven't given enough
information to determine that. Show us the code that you've written to
create these URLs and we should be able to get closer to a solution.

Regards,
Malcolm

-- 
The early bird may get the worm, but the second mouse gets the cheese. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie

Hi, I have a problem of getting my feeds to work with unicode URLs.

 File "/usr/local/lib/python2.4/site-packages/django/contrib/
syndication/feeds.py", line 12, in add_domain
   url = u'http://%s%s' % (domain, url)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
19: ordinal not in range(128)

In all my models I correctly encoded and quoted the URLs, I traced the
problem back to the request.path not being correctly quoted when it is
passed to the feed object.

There seems to be a bug or I'm doing something wrong, please help.
Thanks :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---