Skip to content

An inconsistency and an error#4

Open
sjehuda wants to merge 2 commits intoimattau:masterfrom
sjehuda:patch-4
Open

An inconsistency and an error#4
sjehuda wants to merge 2 commits intoimattau:masterfrom
sjehuda:patch-4

Conversation

@sjehuda
Copy link

@sjehuda sjehuda commented Apr 9, 2024

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

@sjehuda
Copy link
Author

sjehuda commented Apr 9, 2024

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.

@sjehuda
Copy link
Author

sjehuda commented Apr 9, 2024

Original post has been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant