Commit acaefc68 authored by Eliot Berriot's avatar Eliot Berriot

Added python3 support

parent 32a42039
...@@ -2,6 +2,13 @@ Changelog ...@@ -2,6 +2,13 @@ Changelog
========= =========
0.1.1
*****
12/07/2014:
- Added Python 3 support
0.1 0.1
*** ***
......
...@@ -15,6 +15,18 @@ Okay, I'm bad at explaining things, and english is not my mother tongue. Let's b ...@@ -15,6 +15,18 @@ Okay, I'm bad at explaining things, and english is not my mother tongue. Let's b
Quickstart Quickstart
========== ==========
Install
*******
Install the package from [PyPi](https://pypi.python.org/pypi/persisting-theory/) via pip (or any other tool)::
pip install persisting-theory
Persisting theory does not require any dependency but a python installation (it has been tested on Python 2.7 and Python 3.2).
Setup
*****
A basic setup:: A basic setup::
# registries.py # registries.py
......
from registries import Registry, meta_registry from registries import Registry, meta_registry
__version__ = "0.1" __version__ = "0.1.1"
\ No newline at end of file \ No newline at end of file
from collections import OrderedDict from collections import OrderedDict
import inspect import inspect
try:
# use Python3 reload
from imp import reload
except:
# we are on Python2
pass
class Registry(OrderedDict): class Registry(OrderedDict):
def register_decorator_factory(self, **kwargs): def register_decorator_factory(self, **kwargs):
...@@ -75,7 +83,7 @@ class Registry(OrderedDict): ...@@ -75,7 +83,7 @@ class Registry(OrderedDict):
module = __import__(package) module = __import__(package)
if force_reload: if force_reload:
reload(module) reload(module)
except ImportError, e: except ImportError:
# Module does not exist # Module does not exist
pass pass
...@@ -95,7 +103,7 @@ class MetaRegistry(Registry): ...@@ -95,7 +103,7 @@ class MetaRegistry(Registry):
self.autodiscover_registries(apps) self.autodiscover_registries(apps)
def autodiscover_registries(self, apps): def autodiscover_registries(self, apps):
for key, registry in self.iteritems(): for key, registry in self.items():
registry.autodiscover(apps) registry.autodiscover(apps)
meta_registry = MetaRegistry() meta_registry = MetaRegistry()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment