Skip to content

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