[Python-modules-commits] [python-model-mommy] 01/01: New upstream version 1.5.0

Edward Betts edward at moszumanska.debian.org
Tue Jan 16 13:19:13 UTC 2018


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

edward pushed a commit to annotated tag upstream/1.5.0
in repository python-model-mommy.

commit d4359261fe0c935a77c403c1e7bf1f795acb5fb5
Author: Edward Betts <edward at 4angle.com>
Date:   Tue Jan 16 06:54:10 2018 +0000

    New upstream version 1.5.0
---
 PKG-INFO                          |  5 +++--
 README.rst                        |  2 +-
 model_mommy.egg-info/PKG-INFO     |  5 +++--
 model_mommy.egg-info/requires.txt |  2 +-
 model_mommy/__init__.py           |  2 +-
 model_mommy/mommy.py              | 24 ++++++++++++------------
 model_mommy/recipe.py             | 18 +++++++++---------
 requirements.txt                  |  2 +-
 setup.py                          |  3 +--
 tox.ini                           |  3 ++-
 10 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 03ddec3..f90b8ee 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: model_mommy
-Version: 1.4.0
+Version: 1.5.0
 Summary: Smart object creation facility for Django.
 Home-page: http://github.com/vandersonmota/model_mommy
 Author: vandersonmota
 Author-email: vandersonmota at gmail.com
 License: Apache 2.0
+Description-Content-Type: UNKNOWN
 Description: ============================================
         Model Mommy: Smart fixtures for better tests
         ============================================
@@ -13,7 +14,7 @@ Description: ============================================
         *Model-mommy* offers you a smart way to create fixtures for testing in Django.
         With a simple and powerful API you can create many objects with a single line of code.
         
-        .. image:: https://travis-ci.org/vandersonmota/model_mommy.png?branch=master
+        .. image:: https://travis-ci.org/vandersonmota/model_mommy.svg?branch=master
             :target: https://travis-ci.org/vandersonmota/model_mommy
             :alt: Test Status
             
diff --git a/README.rst b/README.rst
index a5cad12..eaa3451 100644
--- a/README.rst
+++ b/README.rst
@@ -5,7 +5,7 @@ Model Mommy: Smart fixtures for better tests
 *Model-mommy* offers you a smart way to create fixtures for testing in Django.
 With a simple and powerful API you can create many objects with a single line of code.
 
-.. image:: https://travis-ci.org/vandersonmota/model_mommy.png?branch=master
+.. image:: https://travis-ci.org/vandersonmota/model_mommy.svg?branch=master
     :target: https://travis-ci.org/vandersonmota/model_mommy
     :alt: Test Status
     
diff --git a/model_mommy.egg-info/PKG-INFO b/model_mommy.egg-info/PKG-INFO
index e380df7..820e7e6 100644
--- a/model_mommy.egg-info/PKG-INFO
+++ b/model_mommy.egg-info/PKG-INFO
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: model-mommy
-Version: 1.4.0
+Version: 1.5.0
 Summary: Smart object creation facility for Django.
 Home-page: http://github.com/vandersonmota/model_mommy
 Author: vandersonmota
 Author-email: vandersonmota at gmail.com
 License: Apache 2.0
+Description-Content-Type: UNKNOWN
 Description: ============================================
         Model Mommy: Smart fixtures for better tests
         ============================================
@@ -13,7 +14,7 @@ Description: ============================================
         *Model-mommy* offers you a smart way to create fixtures for testing in Django.
         With a simple and powerful API you can create many objects with a single line of code.
         
-        .. image:: https://travis-ci.org/vandersonmota/model_mommy.png?branch=master
+        .. image:: https://travis-ci.org/vandersonmota/model_mommy.svg?branch=master
             :target: https://travis-ci.org/vandersonmota/model_mommy
             :alt: Test Status
             
diff --git a/model_mommy.egg-info/requires.txt b/model_mommy.egg-info/requires.txt
index 9b536f6..6cb0137 100644
--- a/model_mommy.egg-info/requires.txt
+++ b/model_mommy.egg-info/requires.txt
@@ -1,2 +1,2 @@
-django>=1.8.0,<1.12
+django>=1.8.0
 six
diff --git a/model_mommy/__init__.py b/model_mommy/__init__.py
index 43affa1..f373c8f 100644
--- a/model_mommy/__init__.py
+++ b/model_mommy/__init__.py
@@ -1,5 +1,5 @@
 #coding:utf-8
-__version__ = '1.4.0'
+__version__ = '1.5.0'
 __title__ = 'model_mommy'
 __author__ = 'Vanderson Mota'
 __license__ = 'Apache 2.0'
diff --git a/model_mommy/mommy.py b/model_mommy/mommy.py
index d146036..a4f5236 100644
--- a/model_mommy/mommy.py
+++ b/model_mommy/mommy.py
@@ -37,14 +37,14 @@ def _valid_quantity(quantity):
     return quantity is not None and (not isinstance(quantity, int) or quantity < 1)
 
 
-def make(model, _quantity=None, make_m2m=False, _save_kwargs=None, _create_files=False, **attrs):
+def make(_model, _quantity=None, make_m2m=False, _save_kwargs=None, _create_files=False, **attrs):
     """
     Creates a persisted instance from a given model its associated models.
     It fill the fields with random values or you can specify
     which fields you want to define its values by yourself.
     """
     _save_kwargs = _save_kwargs or {}
-    mommy = Mommy.create(model, make_m2m=make_m2m, create_files=_create_files)
+    mommy = Mommy.create(_model, make_m2m=make_m2m, create_files=_create_files)
     if _valid_quantity(_quantity):
         raise InvalidQuantityException
 
@@ -54,14 +54,14 @@ def make(model, _quantity=None, make_m2m=False, _save_kwargs=None, _create_files
         return mommy.make(_save_kwargs=_save_kwargs, **attrs)
 
 
-def prepare(model, _quantity=None, _save_related=False, **attrs):
+def prepare(_model, _quantity=None, _save_related=False, **attrs):
     """
     Creates BUT DOESN'T persist an instance from a given model its
     associated models.
     It fill the fields with random values or you can specify
     which fields you want to define its values by yourself.
     """
-    mommy = Mommy.create(model)
+    mommy = Mommy.create(_model)
     if _valid_quantity(_quantity):
         raise InvalidQuantityException
 
@@ -191,14 +191,14 @@ class Mommy(object):
     finder = ModelFinder()
 
     @classmethod
-    def create(cls, model, make_m2m=False, create_files=False):
+    def create(cls, _model, make_m2m=False, create_files=False):
         """
         Factory which creates the mommy class defined by the MOMMY_CUSTOM_CLASS setting
         """
         mommy_class = _custom_mommy_class() or cls
-        return mommy_class(model, make_m2m, create_files)
+        return mommy_class(_model, make_m2m, create_files)
 
-    def __init__(self, model, make_m2m=False, create_files=False):
+    def __init__(self, _model, make_m2m=False, create_files=False):
         self.make_m2m = make_m2m
         self.create_files = create_files
         self.m2m_dict = {}
@@ -207,10 +207,10 @@ class Mommy(object):
         self.rel_attrs = {}
         self.rel_fields = []
 
-        if isinstance(model, ModelBase):
-            self.model = model
+        if isinstance(_model, ModelBase):
+            self.model = _model
         else:
-            self.model = self.finder.get_model(model)
+            self.model = self.finder.get_model(_model)
 
         self.init_type_mapping()
 
@@ -297,7 +297,7 @@ class Mommy(object):
 
         kwargs = filter_rel_attrs(rel_name, **self.rel_attrs)
         kwargs[related.field.name] = instance
-        kwargs['model'] = related.field.model
+        kwargs['_model'] = related.field.model
 
         make(**kwargs)
 
@@ -387,7 +387,7 @@ class Mommy(object):
             generator = self.attr_mapping[field.name]
         elif getattr(field, 'choices'):
             generator = random_gen.gen_from_choices(field.choices)
-        elif isinstance(field, ForeignKey) and issubclass(self._remote_field(field).to, ContentType):
+        elif isinstance(field, ForeignKey) and issubclass(self._remote_field(field).model, ContentType):
             generator = self.type_mapping[ContentType]
         elif generators.get(field.__class__):
             generator = generators.get(field.__class__)
diff --git a/model_mommy/recipe.py b/model_mommy/recipe.py
index eec9b56..8bbff1e 100644
--- a/model_mommy/recipe.py
+++ b/model_mommy/recipe.py
@@ -25,9 +25,9 @@ except TypeError:
 finder = mommy.ModelFinder()
 
 class Recipe(object):
-    def __init__(self, model, **attrs):
+    def __init__(self, _model, **attrs):
         self.attr_mapping = attrs
-        self.model = model
+        self._model = _model
         # _iterator_backups will hold values of the form (backup_iterator, usable_iterator).
         self._iterator_backups = {}
 
@@ -41,10 +41,10 @@ class Recipe(object):
             if new_attrs.get(k):
                 continue
             elif mommy.is_iterator(v):
-                if isinstance(self.model, string_types):
-                    m = finder.get_model(self.model)
+                if isinstance(self._model, string_types):
+                    m = finder.get_model(self._model)
                 else:
-                    m = self.model
+                    m = self._model
                 if k not in self._iterator_backups or m.objects.count() == 0:
                     self._iterator_backups[k] = itertools.tee(self._iterator_backups.get(k, [v])[0])
                 mapping[k] = self._iterator_backups[k][1]
@@ -65,17 +65,17 @@ class Recipe(object):
         return mapping
 
     def make(self, **attrs):
-        return mommy.make(self.model, **self._mapping(attrs))
+        return mommy.make(self._model, **self._mapping(attrs))
 
     def prepare(self, **attrs):
         defaults = {'_save_related': False}
         defaults.update(attrs)
-        return mommy.prepare(self.model, **self._mapping(defaults))
+        return mommy.prepare(self._model, **self._mapping(defaults))
 
     def extend(self, **attrs):
         attr_mapping = self.attr_mapping.copy()
         attr_mapping.update(attrs)
-        return Recipe(self.model, **attr_mapping)
+        return Recipe(self._model, **attr_mapping)
 
 
 class RecipeForeignKey(object):
@@ -97,7 +97,7 @@ class RecipeForeignKey(object):
 
 def foreign_key(recipe):
     """
-      Returns the callable, so that the associated model
+      Returns the callable, so that the associated _model
       will not be created during the recipe definition.
     """
     return RecipeForeignKey(recipe)
diff --git a/requirements.txt b/requirements.txt
index 9b536f6..6cb0137 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
-django>=1.8.0,<1.12
+django>=1.8.0
 six
diff --git a/setup.py b/setup.py
index fb58989..08f5a5d 100755
--- a/setup.py
+++ b/setup.py
@@ -11,8 +11,7 @@ setuptools.setup(
     include_package_data=True,  # declarations in MANIFEST.in
     install_requires=open(join(dirname(__file__), 'requirements.txt')).readlines(),
     tests_require=[
-
-        'django>=1.8,<1.12',
+        'django>=1.8',
         'pil',
         'tox',
         'mock'
diff --git a/tox.ini b/tox.ini
index e685b64..1656c47 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = {py27,py35,py36}-django{18,19,110,111}-{postgresql,sqlite}
+envlist = {py27,py35,py36}-django{18,19,110,111,20}-{postgresql,sqlite}
 
 [testenv]
 setenv=
@@ -18,6 +18,7 @@ deps =
     django19: Django>=1.9,<1.10
     django110: Django>=1.10,<1.11
     django111: Django>=1.11,<1.12
+    django20: Django>=2.0
     postgresql: psycopg2
 
 commands=

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



More information about the Python-modules-commits mailing list