Skip to content
Browse files

Fixes Distillery.bulk() that now only format str or unicode values

  • Loading branch information...
1 parent 958e55a commit bd83c4bf60e4af1b67de42095e0332020db949b6 @jeanphix jeanphix committed Mar 5, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 distillery.py
View
8 distillery.py
@@ -22,9 +22,15 @@ class Distillery(object):
def bulk(cls, count, **kwargs):
"""Bluck creates new instances.
"""
+ def format(value, i):
+ if type(value) in (str, unicode):
+ value = value % {'i': str(i)}
+ return value
+
instances = []
for i in range(count):
- k = {key: kwargs[key] % {'i': str(i)} for key in kwargs}
+
+ k = {key: format(kwargs[key], i) for key in kwargs}
instances.append(cls.create(**k))
return instances

0 comments on commit bd83c4b

Please sign in to comment.
Something went wrong with that request. Please try again.