Skip to content

Commit

Permalink
prepare 0.4.24; rename migrate_03_to_04 command to fobi_migrate_03_to…
Browse files Browse the repository at this point in the history
…_04; add missing app config declarations for the db_store form handler plugin; add missing app config for the main package; improved plugins and modules autodiscover for django>=1.7 when full dotted path to the AppConfig class is provided, instead of a dotted path to the module
  • Loading branch information
barseghyanartur committed Mar 4, 2015
1 parent bc899b8 commit f4f6471
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 29 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.4.24
-------------------------------------
2015-03-04

- The management command `migrate_03_to_04` intended to migrate 0.3.x branch
data to > 0.4.x branch data, has been renamed to `fobi_migrate_03_to_04`.
- Add missing app config declaration for the `db_store` form handler plugin.
- Add missing app config for the core `fobi` package.
- Improved autodiscover for Django>=1.7. Fix exception when using a dotted
path to an `AppConfig` in `INSTALLED_APPS` (instead of using the path to
the app).

0.4.23
-------------------------------------
2015-03-04
Expand Down Expand Up @@ -213,7 +225,9 @@ are used for versioning (schema follows below):

'fobi.contrib.plugins.form_elements.fields.date_drop_down'

3. Run the ``migrate_03_to_04`` management command::
3. Run the ``migrate_03_to_04`` management command. Note, that as of version
0.4.24, the `migrate_03_to_04` command has been renamed to
`fobi_migrate_03_to_04`.::

./manage.py migrate_03_to_04

Expand Down
9 changes: 9 additions & 0 deletions LICENSES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ Licensing information:

- LGPL 3 (https://www.gnu.org/licenses/lgpl.html)

django-nine
==============================
https://github.com/barseghyanartur/django-nine

Licensing information:

- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html)

easy-thumbnails
==============================
https://github.com/SmileyChris/easy-thumbnails
Expand Down
Empty file modified scripts/test_django_1_6.sh
100644 → 100755
Empty file.
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
for locale_dir in locale_dirs:
locale_files += [os.path.join(locale_dir, f) for f in os.listdir(locale_dir)]

version = '0.4.23'
version = '0.4.24'

install_requires = [
'Pillow>=2.0.0',
Expand Down Expand Up @@ -96,7 +96,8 @@
setup(
name = 'django-fobi',
version = version,
description = ("Customisable, modular user- and developer- friendly form generator/builder application for Django"),
description = ("Customisable, modular user- and developer- friendly form "
"generator/builder application for Django"),
long_description = "{0}{1}".format(readme, screenshots),
classifiers = [
"Programming Language :: Python :: 2.6",
Expand All @@ -105,13 +106,15 @@
"Programming Language :: Python :: 3.3",
"Environment :: Web Environment",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
"License :: OSI Approved :: GNU Lesser General Public License v2 or "
"later (LGPLv2+)",
"Framework :: Django",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
],
keywords = 'django, form generator, form builder, visual form designer, user generated forms',
keywords = "django, form generator, form builder, visual form designer, "
"user generated forms",
author = 'Artur Barseghyan',
author_email = '[email protected]',
url = 'https://github.com/barseghyanartur/django-fobi/',
Expand Down
6 changes: 4 additions & 2 deletions src/fobi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
__title__ = 'django-fobi'
__version__ = '0.4.23'
__build__ = 0x000026
__version__ = '0.4.24'
__build__ = 0x000027
__author__ = 'Artur Barseghyan <[email protected]>'
__copyright__ = '2014-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'

default_app_config = 'fobi.apps.Config'
14 changes: 14 additions & 0 deletions src/fobi/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
__title__ = 'fobi.apps'
__author__ = 'Artur Barseghyan <[email protected]>'
__copyright__ = 'Copyright (c) 2014-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('Config',)

try:
from django.apps import AppConfig

class Config(AppConfig):
name = label = 'fobi'

except ImportError:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('default_app_config', 'UID',)

#default_app_config = 'fobi.contrib.plugins.form_handlers.db_store.apps.Config'
default_app_config = 'fobi.contrib.plugins.form_handlers.db_store.apps.Config'

UID = 'db_store'
62 changes: 41 additions & 21 deletions src/fobi/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,24 @@
import logging

from django.conf import settings
from fobi.conf import get_setting

logger = logging.getLogger(__file__)
from nine.versions import DJANGO_GTE_1_7

def autodiscover():
"""
Autodiscovers files that should be found by fobi.
"""
FORM_ELEMENT_PLUGINS_MODULE_NAME = get_setting('FORM_ELEMENT_PLUGINS_MODULE_NAME')
FORM_HANDLER_PLUGINS_MODULE_NAME = get_setting('FORM_HANDLER_PLUGINS_MODULE_NAME')
THEMES_MODULE_NAME = get_setting('THEMES_MODULE_NAME')
FORM_CALLBACKS_MODULE_NAME = get_setting('FORM_CALLBACKS_MODULE_NAME')

#FORM_IMPORTER_PLUGINS_MODULE_NAME = get_setting('FORM_IMPORTER_PLUGINS_MODULE_NAME')

def do_discover(module_name):
# In Django a dotted path can be used up to the app config class. In
# such cases the old-school autodiscovery of modules doesn't work but we
# have a great Django `autodiscover_modules` tool then. In cases if Django
# version is >= 1.7, we use the Django `autodiscover_modules` tool falling back
# to our own implementation of it otherwise.
if DJANGO_GTE_1_7:
from django.utils.module_loading import autodiscover_modules
else:
def autodiscover_modules(module_name):
for app in settings.INSTALLED_APPS:
try:
app = str(app)
app_path = __import__(app, {}, {}, [app.split('.')[-1]]).__path__
except (AttributeError, TypeError) as e:
logger.debug(str(e))
#import ipdb; ipdb.set_trace()
continue

try:
Expand All @@ -40,11 +35,36 @@ def do_discover(module_name):
continue
__import__('{0}.{1}'.format(app, module_name))

# Discover plugins
do_discover(FORM_ELEMENT_PLUGINS_MODULE_NAME)
do_discover(FORM_HANDLER_PLUGINS_MODULE_NAME)
do_discover(THEMES_MODULE_NAME)
do_discover(FORM_CALLBACKS_MODULE_NAME)
from fobi.conf import get_setting

logger = logging.getLogger(__file__)

def autodiscover():
"""
Autodiscovers files that should be found by fobi.
"""
FORM_ELEMENT_PLUGINS_MODULE_NAME = get_setting(
'FORM_ELEMENT_PLUGINS_MODULE_NAME'
)
FORM_HANDLER_PLUGINS_MODULE_NAME = get_setting(
'FORM_HANDLER_PLUGINS_MODULE_NAME'
)
THEMES_MODULE_NAME = get_setting(
'THEMES_MODULE_NAME'
)
FORM_CALLBACKS_MODULE_NAME = get_setting(
'FORM_CALLBACKS_MODULE_NAME'
)

#FORM_IMPORTER_PLUGINS_MODULE_NAME = get_setting(
# 'FORM_IMPORTER_PLUGINS_MODULE_NAME'
# )

# Discover modules
autodiscover_modules(FORM_ELEMENT_PLUGINS_MODULE_NAME)
autodiscover_modules(FORM_HANDLER_PLUGINS_MODULE_NAME)
autodiscover_modules(THEMES_MODULE_NAME)
autodiscover_modules(THEMES_MODULE_NAME)

# Do not yet discover form importers
#do_discover(FORM_IMPORTER_PLUGINS_MODULE_NAME)
#autodiscover_modules(FORM_IMPORTER_PLUGINS_MODULE_NAME)

0 comments on commit f4f6471

Please sign in to comment.