[Python-modules-commits] [django-markupfield] 01/08: Import django-markupfield_1.4.0.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Sat Dec 19 20:18:27 UTC 2015


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

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

commit 73e1359a6e4a8aee7052cbb84e638d623a39396a
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Sat Dec 19 20:52:50 2015 +0100

    Import django-markupfield_1.4.0.orig.tar.gz
---
 CHANGELOG                               |  5 +++
 LICENSE                                 |  5 +--
 PKG-INFO                                | 18 ++++-----
 README.rst                              | 14 +++----
 django_markupfield.egg-info/PKG-INFO    | 18 ++++-----
 django_markupfield.egg-info/SOURCES.txt |  2 +-
 django_markupfield.egg-info/pbr.json    |  1 +
 markupfield/__init__.py                 |  2 +-
 markupfield/fields.py                   | 28 ++++++--------
 markupfield/markup.py                   |  8 ----
 markupfield/models.py                   |  0
 markupfield/tests/models.py             |  2 +-
 markupfield/tests/settings.py           |  2 +
 markupfield/tests/tests.py              | 68 ++++++++++++++++++++++++---------
 setup.py                                |  4 +-
 15 files changed, 96 insertions(+), 81 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 3079802..67f9d2c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+1.4.0 - 17 December 2015
+=========================
+    - bugfixes for Django 1.9
+	- drop support for deprecated Django versions
+
 1.3.5 - 21 May 2015
 ===================
     - properly handle null=True
diff --git a/LICENSE b/LICENSE
index 9a011a6..d759d2e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,7 @@
 django-markupfield
 ==================
 
-Copyright (c) 2010, James Turk
+Copyright (c) 2015, James Turk
 
 All rights reserved.
 
@@ -13,9 +13,6 @@ are permitted provided that the following conditions are met:
     * Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.
-    * Neither the name of django-markupfield nor the names of its contributors
-      may be used to endorse or promote products derived from this software
-      without specific prior written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
diff --git a/PKG-INFO b/PKG-INFO
index a661123..0068f88 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-markupfield
-Version: 1.3.5
+Version: 1.4.0
 Summary: Custom Django field for easy use of markup in text fields
 Home-page: http://github.com/jamesturk/django-markupfield/
 Author: James Turk
@@ -35,7 +35,9 @@ Description: ==================
         Requirements
         ------------
         
-        django-markupfield 1.3 is the last release to support Django 1.4 or Python 3.3, the development version is only tested on Django 1.7 and 1.8 with Python 2.7 and 3.4
+        Requires Django >= 1.7 and Python 2.7 or 3.4+
+        
+        (1.3 is the last release to officially support Django 1.4 or Python 3.3)
         
         Settings
         ========
@@ -67,8 +69,6 @@ Description: ==================
             default `markdown`_ renderer (only if `python-markdown`_ is installed)
         restructuredtext:
             default `ReST`_ renderer (only if `docutils`_ is installed)
-        textile:
-            default `textile`_ renderer (only if `textile`_ is installed)
         
         It is also possible to override ``MARKUP_FIELD_TYPES`` on a per-field basis
         by passing the ``markup_choices`` option to a ``MarkupField`` in your model
@@ -76,10 +76,8 @@ Description: ==================
         
         .. _`markdown`: http://daringfireball.net/projects/markdown/
         .. _`ReST`: http://docutils.sourceforge.net/rst.html
-        .. _`textile`: http://hobix.com/textile/quick.html
-        .. _`python-markdown`: http://www.freewisdom.org/projects/python-markdown/
+        .. _`python-markdown`: https://pypi.python.org/pypi/Markdown
         .. _`docutils`: http://docutils.sourceforge.net/
-        .. _`python-textile`: http://pypi.python.org/pypi/textile
         
         Usage
         =====
@@ -137,9 +135,9 @@ Description: ==================
         
             MarkupField(default_markup_type='markdown')
         
-        ``MarkupField`` that will use textile and not provide a choice on forms::
+        ``MarkupField`` that will use ReST and not provide a choice on forms::
         
-            MarkupField(markup_type='textile')
+            MarkupField(markup_type='restructuredtext')
         
         ``MarkupField`` that will use a custom set of renderers::
         
@@ -198,6 +196,6 @@ Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Environment :: Web Environment
diff --git a/README.rst b/README.rst
index bd516a6..c173a86 100644
--- a/README.rst
+++ b/README.rst
@@ -27,7 +27,9 @@ corresponding translations to your project translation.
 Requirements
 ------------
 
-django-markupfield 1.3 is the last release to support Django 1.4 or Python 3.3, the development version is only tested on Django 1.7 and 1.8 with Python 2.7 and 3.4
+Requires Django >= 1.7 and Python 2.7 or 3.4+
+
+(1.3 is the last release to officially support Django 1.4 or Python 3.3)
 
 Settings
 ========
@@ -59,8 +61,6 @@ markdown:
     default `markdown`_ renderer (only if `python-markdown`_ is installed)
 restructuredtext:
     default `ReST`_ renderer (only if `docutils`_ is installed)
-textile:
-    default `textile`_ renderer (only if `textile`_ is installed)
 
 It is also possible to override ``MARKUP_FIELD_TYPES`` on a per-field basis
 by passing the ``markup_choices`` option to a ``MarkupField`` in your model
@@ -68,10 +68,8 @@ declaration.
 
 .. _`markdown`: http://daringfireball.net/projects/markdown/
 .. _`ReST`: http://docutils.sourceforge.net/rst.html
-.. _`textile`: http://hobix.com/textile/quick.html
-.. _`python-markdown`: http://www.freewisdom.org/projects/python-markdown/
+.. _`python-markdown`: https://pypi.python.org/pypi/Markdown
 .. _`docutils`: http://docutils.sourceforge.net/
-.. _`python-textile`: http://pypi.python.org/pypi/textile
 
 Usage
 =====
@@ -129,9 +127,9 @@ Examples
 
     MarkupField(default_markup_type='markdown')
 
-``MarkupField`` that will use textile and not provide a choice on forms::
+``MarkupField`` that will use ReST and not provide a choice on forms::
 
-    MarkupField(markup_type='textile')
+    MarkupField(markup_type='restructuredtext')
 
 ``MarkupField`` that will use a custom set of renderers::
 
diff --git a/django_markupfield.egg-info/PKG-INFO b/django_markupfield.egg-info/PKG-INFO
index a661123..0068f88 100644
--- a/django_markupfield.egg-info/PKG-INFO
+++ b/django_markupfield.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-markupfield
-Version: 1.3.5
+Version: 1.4.0
 Summary: Custom Django field for easy use of markup in text fields
 Home-page: http://github.com/jamesturk/django-markupfield/
 Author: James Turk
@@ -35,7 +35,9 @@ Description: ==================
         Requirements
         ------------
         
-        django-markupfield 1.3 is the last release to support Django 1.4 or Python 3.3, the development version is only tested on Django 1.7 and 1.8 with Python 2.7 and 3.4
+        Requires Django >= 1.7 and Python 2.7 or 3.4+
+        
+        (1.3 is the last release to officially support Django 1.4 or Python 3.3)
         
         Settings
         ========
@@ -67,8 +69,6 @@ Description: ==================
             default `markdown`_ renderer (only if `python-markdown`_ is installed)
         restructuredtext:
             default `ReST`_ renderer (only if `docutils`_ is installed)
-        textile:
-            default `textile`_ renderer (only if `textile`_ is installed)
         
         It is also possible to override ``MARKUP_FIELD_TYPES`` on a per-field basis
         by passing the ``markup_choices`` option to a ``MarkupField`` in your model
@@ -76,10 +76,8 @@ Description: ==================
         
         .. _`markdown`: http://daringfireball.net/projects/markdown/
         .. _`ReST`: http://docutils.sourceforge.net/rst.html
-        .. _`textile`: http://hobix.com/textile/quick.html
-        .. _`python-markdown`: http://www.freewisdom.org/projects/python-markdown/
+        .. _`python-markdown`: https://pypi.python.org/pypi/Markdown
         .. _`docutils`: http://docutils.sourceforge.net/
-        .. _`python-textile`: http://pypi.python.org/pypi/textile
         
         Usage
         =====
@@ -137,9 +135,9 @@ Description: ==================
         
             MarkupField(default_markup_type='markdown')
         
-        ``MarkupField`` that will use textile and not provide a choice on forms::
+        ``MarkupField`` that will use ReST and not provide a choice on forms::
         
-            MarkupField(markup_type='textile')
+            MarkupField(markup_type='restructuredtext')
         
         ``MarkupField`` that will use a custom set of renderers::
         
@@ -198,6 +196,6 @@ Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Environment :: Web Environment
diff --git a/django_markupfield.egg-info/SOURCES.txt b/django_markupfield.egg-info/SOURCES.txt
index 82137e6..52f149d 100644
--- a/django_markupfield.egg-info/SOURCES.txt
+++ b/django_markupfield.egg-info/SOURCES.txt
@@ -8,11 +8,11 @@ setup.py
 django_markupfield.egg-info/PKG-INFO
 django_markupfield.egg-info/SOURCES.txt
 django_markupfield.egg-info/dependency_links.txt
+django_markupfield.egg-info/pbr.json
 django_markupfield.egg-info/top_level.txt
 markupfield/__init__.py
 markupfield/fields.py
 markupfield/markup.py
-markupfield/models.py
 markupfield/widgets.py
 markupfield/locale/de/LC_MESSAGES/django.mo
 markupfield/locale/de/LC_MESSAGES/django.po
diff --git a/django_markupfield.egg-info/pbr.json b/django_markupfield.egg-info/pbr.json
new file mode 100644
index 0000000..655b143
--- /dev/null
+++ b/django_markupfield.egg-info/pbr.json
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "13efc7b"}
\ No newline at end of file
diff --git a/markupfield/__init__.py b/markupfield/__init__.py
index 5b8f37a..96e3ce8 100644
--- a/markupfield/__init__.py
+++ b/markupfield/__init__.py
@@ -1 +1 @@
-__version__ = '1.3.5'
+__version__ = '1.4.0'
diff --git a/markupfield/fields.py b/markupfield/fields.py
index a14f893..a4179b0 100644
--- a/markupfield/fields.py
+++ b/markupfield/fields.py
@@ -109,10 +109,7 @@ class MarkupField(models.TextField):
                              "allowed values: %s" %
                              (name, ', '.join(self.markup_choices_list)))
 
-        # for South FakeORM compatibility: the frozen version of a
-        # MarkupField can't try to add a _rendered field, because the
-        # _rendered field itself is frozen as well. See introspection
-        # rules below.
+        # for migration compatibility, avoid adding rendered_field
         self.rendered_field = not kwargs.pop('rendered_field', False)
 
         super(MarkupField, self).__init__(verbose_name, name, **kwargs)
@@ -124,7 +121,10 @@ class MarkupField(models.TextField):
             markup_type_field = models.CharField(
                 max_length=30,
                 choices=choices, default=self.default_markup_type,
-                editable=self.markup_type_editable, blank=self.blank)
+                editable=self.markup_type_editable,
+                blank=False if self.default_markup_type else True,
+                null=False if self.default_markup_type else True,
+            )
             rendered_field = models.TextField(editable=False, null=self.null)
             markup_type_field.creation_counter = self.creation_counter + 1
             rendered_field.creation_counter = self.creation_counter + 2
@@ -173,19 +173,13 @@ class MarkupField(models.TextField):
         defaults.update(kwargs)
         return super(MarkupField, self).formfield(**defaults)
 
+    def to_python(self, value):
+        if isinstance(value, Markup):
+            return value
+        else:
+            return super(MarkupField, self).to_python(value)
+
 # register MarkupField to use the custom widget in the Admin
 from django.contrib.admin.options import FORMFIELD_FOR_DBFIELD_DEFAULTS
 FORMFIELD_FOR_DBFIELD_DEFAULTS[MarkupField] = {
     'widget': widgets.AdminMarkupTextareaWidget}
-
-# allow South to handle MarkupField smoothly
-try:
-    from south.modelsinspector import add_introspection_rules
-    # For a normal MarkupField, the add_rendered_field attribute is
-    # always True, which means no_rendered_field arg will always be
-    # True in a frozen MarkupField, which is what we want.
-    add_introspection_rules(rules=[
-        ((MarkupField, ), [], {'rendered_field': ['rendered_field', {}], })
-    ], patterns=['markupfield\.fields\.MarkupField'])
-except ImportError:
-    pass
diff --git a/markupfield/markup.py b/markupfield/markup.py
index 4503275..126513c 100644
--- a/markupfield/markup.py
+++ b/markupfield/markup.py
@@ -86,11 +86,3 @@ try:
                                  _('django-markupfield', 'Restructured Text')))
 except ImportError:
     pass
-
-try:
-    import textile
-    textile_filter = curry(textile.textile, encoding='utf-8', output='utf-8')
-    DEFAULT_MARKUP_TYPES.append(('textile', textile_filter,
-                                 _('django-markupfield', 'Textile')))
-except ImportError:
-    pass
diff --git a/markupfield/models.py b/markupfield/models.py
deleted file mode 100644
index e69de29..0000000
diff --git a/markupfield/tests/models.py b/markupfield/tests/models.py
index 7401e72..ce17c61 100644
--- a/markupfield/tests/models.py
+++ b/markupfield/tests/models.py
@@ -37,7 +37,7 @@ class Concrete(Abstract):
 
 
 class NullTestModel(models.Model):
-    text = MarkupField(null=True, default=None, default_markup_type="markdown")
+    text = MarkupField(null=True, blank=True, default=None, default_markup_type="markdown")
 
 
 class DefaultTestModel(models.Model):
diff --git a/markupfield/tests/settings.py b/markupfield/tests/settings.py
index db17a56..824eb97 100644
--- a/markupfield/tests/settings.py
+++ b/markupfield/tests/settings.py
@@ -38,3 +38,5 @@ INSTALLED_APPS = (
 SECRET_KEY = 'sekrit'
 
 MIDDLEWARE_CLASSES = ()
+
+ROOT_URLCONF = ()
diff --git a/markupfield/tests/tests.py b/markupfield/tests/tests.py
index 5fc47b2..ac66783 100644
--- a/markupfield/tests/tests.py
+++ b/markupfield/tests/tests.py
@@ -86,7 +86,7 @@ class MarkupFieldTestCase(TestCase):
     # Serialization ###########
 
     def test_serialize_to_json(self):
-        stream = serializers.serialize('json', Post.objects.all())
+        stream = serializers.serialize('json', Post.objects.all()[:3])
 
         # Load the data back into Python so that a failed comparison gives a
         # better diff output.
@@ -118,26 +118,27 @@ class MarkupFieldTestCase(TestCase):
                         "title": "example xss post",
                         "comment_markup_type": "markdown",
                         "body_markup_type": "markdown"}},
-            {"pk": 4, "model": "tests.post",
-             "fields": {"body": ('<span style="color: red">plain</span> '
-                                 'post\n\nhttp://example.com'),
-                        "comment": ('<span style="color: red">plain</span> '
-                                    'post\n\nhttp://example.com'),
-                        "_comment_rendered": (
-                            '<p>&lt;span style=&quot;color: red'
-                            '&quot;&gt;plain&lt;/span&gt; '
-                            'post</p>\n\n<p>http://example.com</p>'),
-                        "_body_rendered": ('<p><span style="color: '
-                                           'red">plain</span> '
-                                           'post</p>\n\n<p>http://example.com'
-                                           '</p>'),
-                        "title": "example plain post",
-                        "comment_markup_type": "plain",
-                        "body_markup_type": "plain"}},
+            #{"pk": 4, "model": "tests.post",
+            # "fields": {"body": ('<span style="color: red">plain</span> '
+            #                     'post\n\nhttp://example.com'),
+            #            "comment": ('<span style="color: red">plain</span> '
+            #                        'post\n\nhttp://example.com'),
+            #            "_comment_rendered": (
+            #                '<p>&lt;span style=&quot;color: red'
+            #                '&quot;&gt;plain&lt;/span&gt; '
+            #                'post</p>\n\n<p>http://example.com</p>'),
+            #            "_body_rendered": ('<p><span style="color: '
+            #                               'red">plain</span> '
+            #                               'post</p>\n\n<p>http://example.com'
+            #                               '</p>'),
+            #            "title": "example plain post",
+            #            "comment_markup_type": "plain",
+            #            "body_markup_type": "plain"}},
         ]
         self.assertEqual(len(expected), len(actual))
         for n, item in enumerate(expected):
-            assert item['fields'] == actual[n]['fields']
+            self.maxDiff = None
+            self.assertEqual(item['fields'], actual[n]['fields'])
 
     def test_deserialize_json(self):
         stream = serializers.serialize('json', Post.objects.all())
@@ -153,7 +154,7 @@ class MarkupFieldTestCase(TestCase):
         property called 'raw'" error. This tests the bugfix.
         """
         obj = self.rp
-        field = self.rp._meta.get_field_by_name('body')[0]
+        field = self.rp._meta.get_field('body')
         self.assertNotEqual(field.value_to_string(obj), u'')    # expected
         self.assertEqual(field.value_to_string(None), u'')      # edge case
 
@@ -283,6 +284,35 @@ class MarkupWidgetTests(TestCase):
             Post._meta.get_field('body')).widget, AdminMarkupTextareaWidget))
 
 
+class MarkupFieldFormSaveTests(TestCase):
+
+    def setUp(self):
+        self.data = {'title': 'example post', 'body': '**markdown**',
+                     'body_markup_type': 'markdown'}
+        self.form_class = modelform_factory(Post, fields=['title', 'body',
+                                                          'body_markup_type'])
+
+    def test_form_create(self):
+        form = self.form_class(self.data)
+        form.save()
+
+        actual = Post.objects.get(title=self.data['title'])
+        self.assertEquals(actual.body.raw, self.data['body'])
+
+    def test_form_update(self):
+        existing = Post.objects.create(title=self.data['title'], body=self.data['body'],
+                                       body_markup_type='markdown')
+
+        update = {'title': 'New title', 'body': '**different markdown**',
+                  'body_markup_type': 'markdown',
+                  }
+        form = self.form_class(update, instance=existing)
+        form.save()
+
+        actual = Post.objects.get(title=update['title'])
+        self.assertEquals(actual.body.raw, update['body'])
+
+
 class MarkupFieldLocalFileTestCase(TestCase):
     def test_no_raw(self):
         for markup_opt in DEFAULT_MARKUP_TYPES:
diff --git a/setup.py b/setup.py
index a56add2..c23222e 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ long_description = open('README.rst').read()
 
 setup(
     name='django-markupfield',
-    version="1.3.5",
+    version="1.4.0",
     package_dir={'markupfield': 'markupfield'},
     packages=['markupfield', 'markupfield.tests'],
     package_data={'markupfield': ['locale/*/*/*']},
@@ -25,8 +25,8 @@ setup(
         'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
         'Environment :: Web Environment',
     ],
 )

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



More information about the Python-modules-commits mailing list