vandersonmota/model_mommy — pull request #134 by dencold (2013-10-27 23:12:38+00:00)
Title: Fixing callables on model_mommy Recipe.

This commit addresses an issue with how callables were handled in model_mommy's
Recipe class. Previously, callables were detected and resolved on the `_make`
method of the Recipe class. This caused problems for things like the `_quantity`
api, since subsequent calls to mommy.make would just return the same value that
was first resolved in `_make`. If you tried to introduce randomness into your
mommy generations, you'd find this to be impossible via Recipe and _quantity.

Here is an example that highlights this issue:

```python
from random import choice

from model_mommy import mommy
from model_mommy.recipe import Recipe, seq

FIRSTNAMES = ['Joe', 'Shirly', 'Adam', 'Carol', 'Mason', 'Jane']
LASTNAMES = ['Bourque', 'Neely', 'Moog', 'Esposito', 'Orr', 'Oates']

user_recipe = Recipe('auth.User',
username = seq('user'),
first_name = lambda: choice(FIRSTNAMES),
last_name = lambda: choice(LASTNAMES)
)

users = user_recipe.make(_quantity=3)
for user in users:
print "User: %s First: %s Last: %s" % (user.username,
user.first_name, user.last_name)
```

Results in:

```
User: user1 First: Jane Last: Esposito
User: user2 First: Jane Last: Esposito
User: user3 First: Jane Last: Esposito
```

This PR address the problem and guarantees that the lambda is called each time `make` is called.