Skip to content

An inconsistency and an error #16

@sjehuda

Description

@sjehuda

Greetings!

It would be good to inform that I did not test this part of code that handles authors of which changes can be seen in this PR.

I have questions:

Property "name"

Why is attribute 'authors' being handled differently?

Atom 0.3: name gets author to be a sub-element of it, and "name" as attribute.

author = ET.SubElement(node_entry, "author")
name = ET.SubElement(author, "name")

Atom 1.0: name gets node_entry to be a sub-element of it, and "author" as attribute, which is exectly the same as the variable author above it.

author = ET.SubElement(node_entry, "author")
name = ET.SubElement(node_entry, "author")

Error

This code checks for attribute 'author' (see if hasattr(entry, 'author'):), and for uri.text it attempts to get value from authors (see uri.text = entry.authors[0].href).

elif version == 'rss20' or 'rss10' or 'atom10':
    if hasattr(entry, 'author'):
        author = ET.SubElement(node_entry, "author")
        name = ET.SubElement(node_entry, "author")
        name.text = entry.author
        if hasattr(entry.author, 'href'):
            uri = ET.SubElement(author, "uri")
            uri.text = entry.authors[0].href

Only from reading this part of code, it appears that Atom 0.3 is the one that is handled properly;

Yet, because Atom 0.3 is an exception case, I want to think that my assessment of the code is wrong.


First posted as PR at imattau#4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions