diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 44ce693fb..ae756b347 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,12 @@ are used for versioning (schema follows below): 0.3.4 to 0.4). - All backwards incompatible changes are mentioned in this document. +0.5.7 +----- +2015-08-03 + +- Minor Python 3 improvements. + 0.5.6 ----- 2015-07-31 diff --git a/ROADMAP.rst b/ROADMAP.rst index b2e240fed..7a923d019 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -23,7 +23,7 @@ change of the name of the "simple" theme into "django_admin_style" theme. - Internally, make a date when form has been created. Also keep track of when the form has been last edited. -0.5.7 +0.5.8 ----- yyyy-mm-dd (upcoming). diff --git a/setup.py b/setup.py index a987eadb7..851471fd3 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ for locale_dir in locale_dirs: locale_files += [os.path.join(locale_dir, f) for f in os.listdir(locale_dir)] -version = '0.5.6' +version = '0.5.7' install_requires = [ 'Pillow>=2.0.0', diff --git a/src/fobi/__init__.py b/src/fobi/__init__.py index cbf50e3d9..e16d80422 100644 --- a/src/fobi/__init__.py +++ b/src/fobi/__init__.py @@ -1,6 +1,6 @@ __title__ = 'django-fobi' -__version__ = '0.5.6' -__build__ = 0x00003b +__version__ = '0.5.7' +__build__ = 0x00003c __author__ = 'Artur Barseghyan ' __copyright__ = '2014-2015 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' diff --git a/src/fobi/discover.py b/src/fobi/discover.py index ab13987ef..2f7da14aa 100644 --- a/src/fobi/discover.py +++ b/src/fobi/discover.py @@ -6,13 +6,10 @@ import imp import logging +import sys import six -if six.PY3: - import sys - sys.setrecursionlimit(1500) - from django.conf import settings from nine.versions import DJANGO_GTE_1_7 @@ -49,6 +46,15 @@ def autodiscover(): """ Auto-discovers files that should be found by fobi. """ + # For Python 3 we need to increase the recursion limit, otherwise things + # break. What we want is to set the recursion limit back to its' initial + # value after all plugins have been discovered. + recursion_limit = 1500 + default_recursion_limit = sys.getrecursionlimit() + + if six.PY3 and recursion_limit > default_recursion_limit: + sys.setrecursionlimit(recursion_limit) + FORM_ELEMENT_PLUGINS_MODULE_NAME = get_setting( 'FORM_ELEMENT_PLUGINS_MODULE_NAME' ) @@ -74,3 +80,6 @@ def autodiscover(): # Do not yet discover form importers #autodiscover_modules(FORM_IMPORTER_PLUGINS_MODULE_NAME) + + if six.PY3 and recursion_limit > default_recursion_limit: + sys.setrecursionlimit(default_recursion_limit)