Skip to content

Commit

Permalink
prepare 0.12.20
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Feb 23, 2018
1 parent 481c272 commit 88cc699
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.12.20
-------
2018-02-24

- Minor Python 2 fixes.

0.12.19
-------
2018-02-21
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.12.20
-------
2018-02-24

- Minor Python 2 fixes.

0.12.19
-------
2018-02-21
Expand Down
2 changes: 1 addition & 1 deletion examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-r requirements/django_1_9.txt
-r requirements/django_1_11.txt
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from distutils.version import LooseVersion
from setuptools import setup, find_packages

version = '0.12.19'
version = '0.12.20'

# ***************************************************************************
# ************************** Python version *********************************
Expand Down
2 changes: 1 addition & 1 deletion src/fobi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'django-fobi'
__version__ = '0.12.19'
__version__ = '0.12.20'
__author__ = 'Artur Barseghyan <[email protected]>'
__copyright__ = '2014-2018 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
Expand Down
6 changes: 5 additions & 1 deletion src/fobi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
CUSTOM_THEME_DATA,
DEBUG,
DEFAULT_THEME,
FAIL_ON_ERRORS_IN_FORM_ELEMENT_PLUGINS,
FAIL_ON_ERRORS_IN_FORM_HANDLER_PLUGINS,
FAIL_ON_ERRORS_IN_FORM_WIZARD_HANDLER_PLUGINS,
FAIL_ON_MISSING_FORM_ELEMENT_PLUGINS,
Expand Down Expand Up @@ -1665,7 +1666,10 @@ def get_origin_kwargs_update_func_results(self, kwargs_update_func,
if kwargs_update:
return kwargs_update
except Exception as err:
logger.debug(str(err))
if FAIL_ON_ERRORS_IN_FORM_ELEMENT_PLUGINS:
raise err
else:
logger.error(str(err))
return {}

def _submit_plugin_form_data(self, form_entry, request, form,
Expand Down
2 changes: 1 addition & 1 deletion src/fobi/contrib/plugins/form_handlers/mail/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def send_email(self, rendered_data, files):

send_mail(
safe_text(self.data.subject),
"{0}\n\n{1}".format(
u"{0}\n\n{1}".format(
safe_text(self.data.body),
''.join(rendered_data)
),
Expand Down
11 changes: 6 additions & 5 deletions src/fobi/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.http import HttpResponse
from django.templatetags.static import static
from django.test.client import RequestFactory
from django.utils.encoding import force_text
from django.utils.encoding import force_text, smart_text
from django.utils.html import format_html_join
from django.utils.translation import ugettext_lazy as _

Expand Down Expand Up @@ -108,10 +108,11 @@ def safe_text(text):
:return str:
"""
if PY3:
return force_text(text, encoding='utf-8')
else:
return force_text(text, encoding='utf-8').encode('utf-8')
return smart_text(text)
# if PY3:
# return force_text(text, encoding='utf-8')
# else:
# return force_text(text, encoding='utf-8').encode('utf-8')


def lists_overlap(sub, main):
Expand Down
33 changes: 31 additions & 2 deletions src/fobi/tests/data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from __future__ import unicode_literals
import copy
from collections import OrderedDict
import datetime
Expand Down Expand Up @@ -238,6 +239,13 @@
'help_text': "Lorem ipsum text area",
'required': True,
},

# Add a "Text" (text input) form element
# force_text(TextInputPlugin.name): {
# 'label': u"Անուն",
# 'help_text': u"Անուն",
# 'required': True,
# },
}

TEST_FORM_FIELD_DATA = {
Expand Down Expand Up @@ -266,6 +274,7 @@
'test_text': 'Lorem ipsum',
'test_text_area': 'Dolor sit amet',
'test_url_input': 'http://dev.example.com',
# 'test_unicode_text': u'Անուն',
}

TEST_FORM_HANDLER_PLUGIN_DATA = {
Expand Down Expand Up @@ -598,7 +607,20 @@
'semper lorem rhoncus sem cras amet."'
'}'
)
)
),
# (
# 'unicode_name',
# (
# TextInputPlugin.uid,
# '{'
# '"name": "unicode_name", '
# '"required": true, '
# '"max_length": 200, '
# '"label": u"Անուն", '
# '"placeholder": u"Անուն"'
# '}'
# )
# ),
])

TEST_DYNAMIC_FORMS_DEFINITION_DATA_DRF = copy.copy(
Expand Down Expand Up @@ -627,6 +649,7 @@
'special_fields': FAKER.pystr(),
'number_of_children': FAKER.pyint(),
'bio': FAKER.text(),
# 'unicode_name': u'Անուն',
}

TEST_DYNAMIC_FORMS_PUT_DATA = copy.copy(TEST_DYNAMIC_FORMS_PUT_DATA_ALL)
Expand Down Expand Up @@ -664,5 +687,11 @@
(u'bio', OrderedDict([(u'type', u'string'),
(u'required', True),
(u'read_only', False),
(u'label', u'Biography')]))
(u'label', u'Biography')])),
# (u'unicode_name', OrderedDict([(u'type', u'string'),
# (u'required', True),
# (u'read_only', False),
# (u'label', u'Անուն'),
# (u'max_length', 200),
# (u'placeholder', u'Անուն')])),
])
11 changes: 7 additions & 4 deletions src/fobi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def get_user_plugins_grouped(get_allowed_plugin_uids_func,

ordered_registered_plugins = OrderedDict()
for key, prop in sorted(registered_plugins.items()):
import ipdb; ipdb.set_trace()
if sort_by_value:
ordered_registered_plugins[key] = sorted(prop, key=lambda t: t[1])
else:
Expand Down Expand Up @@ -610,13 +609,17 @@ def append_edit_and_delete_links_to_field(form_element_plugin,
help_text = ''

data_dict = {
'help_text': "{0} {1}".format(help_text, help_text_extra),
'help_text': u"{0} {1}".format(help_text, help_text_extra),
}

label = safe_text(getattr(form_element_plugin.data, 'label', ''))
data_dict.update(
{'label': "{0} ({1})".format(label,
safe_text(form_element_plugin.name))}
{
'label': u"{0} ({1})".format(
label,
safe_text(form_element_plugin.name)
)
}
)

# if 'hidden' == form_element_plugin.uid:
Expand Down

0 comments on commit 88cc699

Please sign in to comment.