Skip to content
This repository has been archived by the owner on Jan 29, 2018. It is now read-only.

Commit

Permalink
Moved OrderedDict importing to compat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
drdaeman committed Dec 5, 2012
1 parent e961b88 commit 0e01df3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
5 changes: 1 addition & 4 deletions flask_toybox/__init__.py
@@ -1,10 +1,7 @@
from __future__ import absolute_import

from .serialization import JSON
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .compat import OrderedDict

class ToyBox(object):
def __init__(self, app):
Expand Down
9 changes: 9 additions & 0 deletions flask_toybox/compat.py
@@ -0,0 +1,9 @@
"""
Cross-version compatibility module.
"""

from __future__ import absolute_import
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
6 changes: 2 additions & 4 deletions flask_toybox/serialization.py
Expand Up @@ -7,11 +7,9 @@
*deserializers*. The names are hopefully self-describing.
"""

from __future__ import absolute_import
import json
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .compat import OrderedDict
import decimal

class ExtendedJSONEncoder(json.JSONEncoder):
Expand Down
5 changes: 1 addition & 4 deletions flask_toybox/sqlalchemy.py
Expand Up @@ -11,10 +11,7 @@

from __future__ import absolute_import

try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .compat import OrderedDict
from sqlalchemy.orm import column_property, class_mapper, relationship, ColumnProperty, object_session
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.schema import Column
Expand Down

0 comments on commit 0e01df3

Please sign in to comment.