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

Make bodywidth kwarg overridable using config #84

Merged
merged 1 commit into from
Jul 4, 2015

Conversation

emillon
Copy link
Contributor

@emillon emillon commented Jun 29, 2015

Hey,

I believe I hit a problem with your library.

Default values for arguments are evaluated at import time.
This makes a problem when using html2text the following way:

import html2text  # The default value is evaluated here
html2text.config.BODY_WIDTH = 0
text = html2text.html2text(html)

It is thus necessary to wait until the function runs to fetch the actual
configuration value.

Thanks for maintaining html2text!

@emillon
Copy link
Contributor Author

emillon commented Jun 30, 2015

I'll add a test for this.

@theSage21
Copy link
Collaborator

@emillon Thanks for the fix. 😄

@Alir3z4
Copy link
Owner

Alir3z4 commented Jul 1, 2015

@emillon Thanks for the patch, please fix the test suite and have a look at https://github.com/Alir3z4/html2text/blob/master/docs/contributing.md

Thanks for the great work.

Default values for arguments are evaluated at import time.
This makes a problem when using html2text the following way:

    import html2text  # The default value is evaluated here
    html2text.config.BODY_WIDTH = 0
    text = html2text.html2text(html)

It is thus necessary to wait until the function runs to fetch the actual
configuration value.
@emillon emillon force-pushed the bodywidth-kwarg branch from 8f00e71 to 4a93656 Compare July 1, 2015 18:54
@emillon
Copy link
Contributor Author

emillon commented Jul 1, 2015

There were no tests for the html2text.html2text function, so I added a third component to what generate_test returns. However, running it for the whole test suite does not work, because most options do not have a kwarg configuration. So I chose to run the "function" variant only for two tests, which adds enough coverage. Let me know what you think.

Alir3z4 added a commit that referenced this pull request Jul 4, 2015
Make bodywidth kwarg overridable using config

Thanks @emillon
@Alir3z4 Alir3z4 merged commit e71752d into Alir3z4:master Jul 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants