diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..079ca1a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +sudo: false +language: python + +python: + - "2.6" + - "2.7" + - "pypy" + - "3.3" + - "3.4" + +install: + - pip install pytest-cov + - pip install -e . + +script: + - py.test --cov=flask_zodb tests.py + +after_success: + - pip install coveralls + - coveralls diff --git a/README.mkd b/README.mkd index a677c5d..1cded82 100644 --- a/README.mkd +++ b/README.mkd @@ -3,6 +3,9 @@ Flask-ZODB ![Flask-ZODB][logo] +[![Build Status](https://travis-ci.org/Kyah/flask-zodb.svg)](https://travis-ci.org/Kyah/flask-zodb) +[![Coverage Status](https://coveralls.io/repos/Kyah/flask-zodb/badge.svg?branch=master&service=github)](https://coveralls.io/github/Kyah/flask-zodb?branch=master) + Simple extension for integrating the ZODB in Flask applications. diff --git a/flask_zodb.py b/flask_zodb.py index a950cf1..e5e70ac 100644 --- a/flask_zodb.py +++ b/flask_zodb.py @@ -2,7 +2,11 @@ import transaction import zodburi -from UserDict import IterableUserDict +try: + from collections import UserDict +except ImportError: + from UserDict import IterableUserDict as UserDict + from ZODB.DB import DB from contextlib import contextmanager, closing from werkzeug.utils import cached_property @@ -12,11 +16,15 @@ from persistent.list import PersistentList as List from persistent.mapping import PersistentMapping as Dict +try: + basestring +except NameError: + basestring = str __all__ = ['ZODB', 'Object', 'List', 'Dict', 'BTree'] -class ZODB(IterableUserDict): +class ZODB(UserDict): """Extension object. Behaves as the root object of the storage during requests, i.e. a `~persistent.mapping.PersistentMapping`. diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 0755c5d..0000000 --- a/tox.ini +++ /dev/null @@ -1,6 +0,0 @@ -[tox] -envlist = py25, py26, py27 - -[testenv] -deps = pytest -commands = py.test tests.py