Skip to content

Commit f552c7a

Browse files
authored
fix #794
fix the issue that when a marshmallow old version (below 2.17.0) installed, an unexpected AttributeError raised cause there is no __version_info__ attribute in **__init__.py**.
1 parent 676fd02 commit f552c7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hug/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import uuid as native_uuid
2525
from decimal import Decimal
26+
from distutils.version import LooseVersion
2627

2728
import hug._empty as empty
2829
from hug import introspect
@@ -34,7 +35,7 @@
3435
import marshmallow
3536
from marshmallow import ValidationError
3637

37-
MARSHMALLOW_MAJOR_VERSION = marshmallow.__version_info__[0]
38+
MARSHMALLOW_MAJOR_VERSION = getattr(marshmallow,'__version_info__',LooseVersion(marshmallow.__version__).version)[0]
3839
except ImportError:
3940
# Just define the error that is never raised so that Python does not complain.
4041
class ValidationError(Exception):

0 commit comments

Comments
 (0)