Iceberg,

Thank you.
Maybe I didn't explain what I wanted well, but you understood very well!
Actually the solution is so simple it is embarrassing :-)

Miguel


On Tue, Aug 3, 2010 at 9:51 AM, Iceberg <iceb...@21cn.com> wrote:

> Don't what you really want. In short, modules organize your functional
> code, but you still need to "expose" them in your controller.
>
> # In controllers/default.py
> def index():
>    return {'': DIV( LOAD(url=URL(r=request, f='foo.load')) )}
> def foo():
>    return {'': local_import('my_module').my_func()}
>
> # In modules/my_module.py
> def my_func():
>    return FORM(...)
>
> Iceberg
>
> On Aug 2, 10:19 pm, Miguel Lopes <mig.e.lo...@gmail.com> wrote:
> > yes I've tried it. local_import does not work. the LOAD function
> signature
> > expects a controller name and function name (defaulting to the
> > request.application), as far as I know it is not possible to pass it a
> > function - at least supplying it a function object does not work.
> >
> > Miguel
> >
> >
> >
> > On Mon, Aug 2, 2010 at 2:51 PM, Bruno Rocha <rochacbr...@gmail.com>
> wrote:
> > > Have you tried local_import()?
> > > I really dont know if that will work in your case, Give it a try
> >
> > >http://web2py.com/book/default/chapter/04?search=local_import
> >
> > > 2010/8/2 Miguel Lopes <mig.e.lo...@gmail.com>
> >
> > > I have several functions returning forms in a module file, and started
> > >> experimenting with the LOAD function, but I can figure out how to use
> this
> > >> functions without moving them to the controller. I would prefer to
> keep
> > >> these functions in a module for code organization reasons. I wonder if
> it is
> > >> possible, and if not what solution do you use for code organization?
> >
> > >> Miguel
> >
> > > --
> >
> > >http://rochacbruno.com.br
>

Reply via email to