From 68c3b4508a1443d49d2a6f81900390c5af9decf1 Mon Sep 17 00:00:00 2001 From: Tim Gates Date: Mon, 8 Apr 2019 11:00:04 +1000 Subject: [PATCH] Adjust Markdown Version Checks to Avoid Warning --- rest_framework/compat.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 9422e6ad5..3e1706b6a 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -184,10 +184,12 @@ if 'patch' not in View.http_method_names: try: import markdown - if markdown.version <= '2.2': + if not hasattr(markdown, '__version__') and markdown.version <= '2.2': HEADERID_EXT_PATH = 'headerid' LEVEL_PARAM = 'level' - elif markdown.version < '2.6': + elif not hasattr(markdown, '__version__') or ( + type(markdown.__version__) != type('') and markdown.version < '2.6' + ): HEADERID_EXT_PATH = 'markdown.extensions.headerid' LEVEL_PARAM = 'level' else: