[Python-modules-commits] [django-floppyforms] 01/05: Import django-floppyforms_1.6.1+dfsg.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Mon Feb 22 07:33:25 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository django-floppyforms.

commit 9d11c6abeb18994c9e79d425f44e80a953f877c4
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Mon Feb 22 08:18:15 2016 +0100

    Import django-floppyforms_1.6.1+dfsg.orig.tar.gz
---
 .travis.yml             | 24 +++++++++++++++++++-----
 CHANGES.rst             |  8 ++++++++
 floppyforms/__init__.py |  2 +-
 floppyforms/widgets.py  |  8 +-------
 requirements/tests.txt  |  1 +
 tests/test_widgets.py   | 26 +++++++++++++++++++-------
 tox.ini                 |  4 ++--
 7 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d44783b..78621e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,11 +10,12 @@ env:
   - TOXENV=py27-17
   - TOXENV=py27-18
   - TOXENV=py27-19
-  - TOXENV=py32-15
-  - TOXENV=py32-16
-  - TOXENV=py32-17
-  - TOXENV=py32-18
-  - TOXENV=py32-18
+  # Disabling Python 3.2 tests for now as we have Problems with pip 8 on Travis
+  # - TOXENV=py32-15
+  # - TOXENV=py32-16
+  # - TOXENV=py32-17
+  # - TOXENV=py32-18
+  # - TOXENV=py32-18
   - TOXENV=py33-15
   - TOXENV=py33-16
   - TOXENV=py33-17
@@ -24,6 +25,8 @@ env:
   - TOXENV=py34-17
   - TOXENV=py34-18
   - TOXENV=py34-19
+  - TOXENV=py35-18
+  - TOXENV=py35-19
   - TOXENV=pypy-14
   - TOXENV=pypy-15
   - TOXENV=pypy-16
@@ -47,6 +50,8 @@ before_install:
   # GIS requirements.
   - sudo apt-get -q -y install binutils gdal-bin libproj-dev libgeos-c1
 install:
+  # pip >= 8 dropped Python 3.2 support
+  - pip install "pip<8.0.0" wheel
   - pip install tox
 script:
   - tox
@@ -56,3 +61,12 @@ notifications:
       - "irc.freenode.org#django-floppyforms"
     on_success: change
     on_failure: always
+deploy:
+  provider: pypi
+  user: gremu
+  password:
+    secure: HAgxb7ebUfIQSfcxtjKoXO3FCBiujCo4GU2lYO8IUPeSdurPG6e+uABzwg88d7Zt1Zuay2eleAJzqhvwU2bCOKr68wjkNw3yWRslvLAMK3vj2LPPoWYsgmLJ1YiOvPloCdD2sIVSmpLEiN5HLUteh5j6D2BUbw67a9S2TXx1J8c=
+  on:
+    tags: true
+    repo: gregmuellegger/django-floppyforms
+    condition: "$TOXENV = py35-18"
diff --git a/CHANGES.rst b/CHANGES.rst
index ffec2f0..250a524 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,14 @@
 Changelog
 ---------
 
+1.6.1
+~~~~~
+
+* `#167`_: Fix django-floppyforms' ``CheckboxInput.value_from_datadict`` which
+  was inconsistent with Django's behaviour.
+
+.. _#167: https://github.com/gregmuellegger/django-floppyforms/issues/167
+
 1.6.0
 ~~~~~
 
diff --git a/floppyforms/__init__.py b/floppyforms/__init__.py
index f774ae3..e0d7b82 100644
--- a/floppyforms/__init__.py
+++ b/floppyforms/__init__.py
@@ -20,4 +20,4 @@ except Exception:
     warnings.warn(
         "Unable to import floppyforms.gis, geometry widgets not available")
 
-__version__ = '1.6.0'
+__version__ = '1.6.1'
diff --git a/floppyforms/widgets.py b/floppyforms/widgets.py
index f78d124..f8d9f38 100644
--- a/floppyforms/widgets.py
+++ b/floppyforms/widgets.py
@@ -443,13 +443,7 @@ class CheckboxInput(Input, forms.CheckboxInput):
         return value
 
     def value_from_datadict(self, data, files, name):
-        if name not in data:
-            return False
-        value = data.get(name)
-        values = {'true': True, 'false': False}
-        if isinstance(value, six.string_types):
-            value = values.get(value.lower(), value)
-        return value
+        return forms.CheckboxInput.value_from_datadict(self, data, files, name)
 
     if django.VERSION < (1, 6):
         def _has_changed(self, initial, data):
diff --git a/requirements/tests.txt b/requirements/tests.txt
index ceab467..8218943 100644
--- a/requirements/tests.txt
+++ b/requirements/tests.txt
@@ -1,3 +1,4 @@
+pip<8.0.0
 argparse
 coverage<4.0
 flake8
diff --git a/tests/test_widgets.py b/tests/test_widgets.py
index 1647dd9..881c644 100644
--- a/tests/test_widgets.py
+++ b/tests/test_widgets.py
@@ -459,15 +459,27 @@ class WidgetRenderingTest(TestCase):
         </p>
         """)
 
-        form = CBForm(data={'cb': 'foo'})
+        form = CBForm(data={'cb': 'on'})
         self.assertTrue(form.is_valid())
         rendered = form.as_p()
-        self.assertHTMLEqual(rendered, """
-        <p>
-            <label for="id_cb">Cb:</label>
-            <input type="checkbox" name="cb" id="id_cb" required checked value="foo">
-        </p>
-        """)
+
+        # The behaviour of the value attribute changed with Django 1.5. Prior
+        # it was included as given in ``data``. Now it's always excluded as the
+        # value is casted to a bool. See #167 for more details.
+        if django.VERSION < (1, 5):
+            self.assertHTMLEqual(rendered, """
+            <p>
+                <label for="id_cb">Cb:</label>
+                <input type="checkbox" name="cb" id="id_cb" required checked value="on">
+            </p>
+            """)
+        else:
+            self.assertHTMLEqual(rendered, """
+            <p>
+                <label for="id_cb">Cb:</label>
+                <input type="checkbox" name="cb" id="id_cb" required checked>
+            </p>
+            """)
 
     @skipUnless(sys.version_info[0] < 3, 'Only applies to Python 2')
     def test_checkbox_string_values(self):
diff --git a/tox.ini b/tox.ini
index 2a6b979..233a68f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,7 +8,7 @@ envlist =
     py32-{15,16,17,18},
     py33-{15,16,17,18},
     py34-{15,16,17,18,19},
-    # py35-{19},
+    py35-{18,19},
     pypy-{14,15,16,17,18,19}
 
 [testenv]
@@ -18,7 +18,7 @@ deps =
     16: Django >= 1.6, < 1.7
     17: Django >= 1.7, < 1.8
     18: Django >= 1.8, < 1.9
-    19: https://github.com/django/django/tarball/stable/1.9.x
+    19: Django >= 1.9, < 1.10
     -r{toxinidir}/requirements/tests.txt
 commands = python runtests.py
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-floppyforms.git



More information about the Python-modules-commits mailing list