Skip to content

Bring back the old version variable #709

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

Merged
merged 2 commits into from Sep 22, 2018
Merged

Bring back the old version variable #709

merged 2 commits into from Sep 22, 2018

Conversation

ghost
Copy link

@ghost ghost commented Sep 22, 2018

To fix an AttributeError for backward-compatibility:

if markdown.version <= '2.2':
AttributeError: module 'markdown' has no attribute 'version'

In this case from django-rest-framework.

@waylan
Copy link
Member

waylan commented Sep 22, 2018

I'm really annoyed by this. I only want to have the __version__ variable, but a version variable name that is not consistent across versions is not very useful. Sigh.

Thanks for the patch.

@waylan waylan merged commit cc2d85c into Python-Markdown:master Sep 22, 2018
@ghost
Copy link
Author

ghost commented Sep 23, 2018

Yeah, I feel your pain. My first reaction was to submit a PR to django-restframework, but then realized this will be a common problem with other code that uses Python-Markdown. The backwards-compatibility woes of a popular library. ;-)

@mitya57
Copy link
Collaborator

mitya57 commented Sep 23, 2018

Note that Python-Markdown 2.6.11 had a version_info attribute too (as opposed to __version_info__ in 3.0). There is (at least some) third-party code that uses it too:

https://codesearch.debian.net/search?q=markdown.version_info

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