Permalink
Browse files

empty_value kwarg

  • Loading branch information...
1 parent 41b674f commit 45fcf44edc3bf0290793dbda5c51de25f22c3685 Mikko Hellsing committed Oct 18, 2010
Showing with 13 additions and 3 deletions.
  1. +4 −0 CHANGES.rst
  2. +8 −2 mockups/generators.py
  3. +1 −1 setup.py
View
@@ -1,6 +1,10 @@
Changelog
=========
+0.4.3
+-----
+* Make generators take empty_value keyword argument
+
0.4.2
-----
* Make ModelMockup take a factory instance as keyword argument for more
View
@@ -35,15 +35,21 @@ class GeneratorException(Exception):
pass
+class IGNORE_EMPTY(object):
+ pass
+
+
class Generator(object):
coerce_type = staticmethod(lambda x: x)
empty_value = None
empty_p = 0
- def __init__(self, empty_p=None, coerce=None):
+ def __init__(self, empty_p=None, empty_value=IGNORE_EMPTY, coerce=None):
if empty_p is not None:
self.empty_p = empty_p
- if coerce:
+ if empty_value is not IGNORE_EMPTY:
+ self.empty_value = empty_value
+ if coerce is not None:
self.coerce_type = coerce
def coerce(self, value):
View
@@ -32,7 +32,7 @@ def split(self, *args, **kw):
setup(
name = 'django-mockups',
- version = '0.4.2',
+ version = '0.4.3',
url = 'https://github.com/sorl/django-mockups',
license = 'BSD',
description = 'Provides tools to auto generate content.',

0 comments on commit 45fcf44

Please sign in to comment.