Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An inconsistency and an error #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

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