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

Edit if condition to check for embedded resources #20

Merged
merged 1 commit into from
May 23, 2018
Merged

Conversation

duskybomb
Copy link

We can merge this. It was my initial commit to branch issue/16

@m3nu
Copy link
Collaborator

m3nu commented May 23, 2018

Here is the issue with this PR:

  • \EmbeddedFiles is contained in \Names
  • We want to fail if \Names doesn't exist. If \Names doesn't exist, \EmbeddedFiles also can't exist.
  • The way you wrote it is confusing.
  • The correct way would be to:
  1. check for \Names.
  2. If \Names exists, check for \EmbeddedFiles.

By doing this you can take advantage of the fact that Python checks AND conditions from left to right.

@duskybomb
Copy link
Author

You mean I should use nested if?

@m3nu
Copy link
Collaborator

m3nu commented May 23, 2018

Using an and would be clearest. But it's fine. If it fixes your issue, let's merge it. I didn't realize this is only a very minor check before reading the XML.

I also don't like too many nots. This is generally a sign of bad layout.

@m3nu m3nu merged commit 99d4833 into master May 23, 2018
@duskybomb duskybomb deleted the duskybomb-embedded branch May 29, 2018 04:31
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.

2 participants