Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#1572 closed task (fixed)

[M-R][Patch]feedgenerator.py should also support only username or email

Reported by: limodou@… Owned by: Adrian Holovaty
Component: Documentation Version:
Severity: trivial Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found that Rss201rev2Feed in feedgenerator.py only support both username and email supplied situation, and I think if there is only username or email it also need support. And I also change the outpu format from :

email ( username ) to username ( email ) if both of them supplied

I think it's the common format of the author. And I also found that if I'm using Chinese in author_name, they'll be complained that:

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

So I remove 'u' string prefix.

Attachments (2)

feedgenerator.py.patch (1.1 KB ) - added by limodou@… 18 years ago.
feedgenerator_02.py.patch (914 bytes ) - added by limodou@… 18 years ago.

Download all attachments as: .zip

Change History (8)

by limodou@…, 18 years ago

Attachment: feedgenerator.py.patch added

comment:1 by James Bennett, 18 years ago

Not that the RSS spec is useful for anything other than beating one's head against in frustration, but 'email (name)' is what the spec uses, and it doesn't provide any guide, other than its example which includes both email address and name, as to whether a feed can legally omit the name. As to omitting the email address, the spec defines the 'author' element as "Email address of the author of the item", which seems to indicate, about as clearly as the RSS spec indicates anything, that omitting the email address is not permitted.

comment:2 by limodou@…, 18 years ago

I think feedgenerator is just an util module, and how to provide rss should be the duty of developer, but not let feedgenerator to decide. If one don't want to show the email of the user, or need both user name and user email he could validate these check before create the rss feed, and it's not difficult. And I think let developer know what he does is very useful.

The format of username(email) I think is a convention. And at least, feedgenerator should enable only username, but not need both username and email. I of course set email , or username , to let either only username or only email. But I think if feedgenerator can support only username or only email is better, so I don't need to set email or username .

comment:3 by James Bennett, 18 years ago

The problem here, as I see it, is not utility -- the problem is conformance to the spec. The RSS spec pretty clearly lays out that there has to be an email address there, and pretty clearly gives an example of the form 'email (user)'. Conformance to the RSS spec would seem to require, then, that both be present and that they occur in that order.

comment:4 by limodou@…, 18 years ago

I did review the RSS 2.0 Spec, and it's exactly like what you said:

<author> is an optional sub-element of <item>.

It's the email address of the author of the item. For newspapers and magazines syndicating via RSS, the author is the person who wrote the article that the <item> describes. For collaborative weblogs, the author of the item might be different from the managing editor or webmaster. For a weblog authored by a single individual it would make sense to omit the <author> element.

<author>lawyer@… (Lawyer Boyer)</author>

And you can see, the rss spec need at least an email, or both username and email. And the feedgenerator.py need all email and username:

if item['author_email'] is not None and item['author_name'] is not None: 
   handler.addQuickElement(u"author", u"%s (%s)" % \ 
  (item['author_email'], item['author_name']))

So I think this process is exactly not match the RSS spec. It should support only email or both username and email I think.

by limodou@…, 18 years ago

Attachment: feedgenerator_02.py.patch added

comment:5 by Jacob, 18 years ago

Resolution: fixed
Status: newclosed

(In [2617]) magic-removal: fixed #1572 -- feedgenerator RSSv2 feeds now support missing author names (thanks, limodou)

comment:6 by anonymous, 18 years ago

Component: RSS frameworkDocumentation
priority: normallow
Severity: normaltrivial
Type: defecttask
Version: magic-removal
Note: See TracTickets for help on using tickets.
Back to Top