berinhard/model_mommy

Trying to understand docs

mxlian opened this issue · 2 comments

In the documentation for Recipes (link provided below), the first two code snippets are for different files: mommy_recipes.py and test_model.py.

My impression is that mommy_recipes.py was created for be later used as a Recipe in the example of test_model.py. But docs don't reflect that:

See here:
https://github.com/vandersonmota/model_mommy/blame/master/docs/source/recipes.rst#L68

Shouldn't that line be 'mommy_recipes.person'?

Thanks for the explanation in advance

I answer myself: no.

The following statement mommy.make_recipe('family.person') will load the recipe person from the file family/mommy_recipes.py.

That behaviour is in the mommy.py:

def _recipe(name):
    app, recipe_name = name.rsplit('.', 1)
    return import_from_str('.'.join((app, 'mommy_recipes', recipe_name)))

This is not very clear in the docs

as far as i can see, this is fixed and can be closed!