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

The defaults are different in __main__ #220

Open
peterbe opened this issue Apr 25, 2019 · 2 comments
Open

The defaults are different in __main__ #220

peterbe opened this issue Apr 25, 2019 · 2 comments

Comments

@peterbe
Copy link
Owner

peterbe commented Apr 25, 2019

You get different output run you run:

$ python -m premailer -f /tmp/foo.html

...compared to...

with open('/tmp/foo.html') as f:
    html = f.read()
print(premailer.transform(html))

Seems the defaults in __main__ are probably different from those in the Premailer class's __init__

Not sure which or how it compares to the README but they should all ideally be the same.

@peterbe
Copy link
Owner Author

peterbe commented Apr 25, 2019

I think it only manifests itself with certain more advanced features/options.
Here's the /tmp/foo.html example: https://gist.github.com/peterbe/51f687adf87cf294080d6b0596992966

@peterbe
Copy link
Owner Author

peterbe commented Apr 25, 2019

The point is, the __init__ method has a long list of options/settings. Some are True and some are False. (Just focussing on the booleans).

When using argparse it doesn't make sense to use default=True on any of them because your only choice is to not type the argument or type it.

Ideally, ALL options (everywhere) should be False by default. For things that are currently True by default, they'd need to be rewritten. For example exclude_psueduoclasses=True would need to be rewritten to include_pseudoclasses=False.

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

No branches or pull requests

1 participant