Re: [web2py] Functions in Views

2012-08-13 Thread Kevin Miller
Thank you very much Bruno.
Just found out that I can return it in view.

Thanks a lot for your reply.

On Mon, Aug 13, 2012 at 7:48 PM, Bruno Rocha  wrote:

> You only can call functions that are in global scope.
>
> if you define function in /models/ so you can call those functions in
> controllers and views.
>
> If you defined in controller, so you have to return it to the view.
>
> controller/default.py
> ---
>
> def foo():
> return "bar"
>
> def index():
> name = "Bruno"
> form = FORM()
> return dict(form=form, name=name, foo=foo)
>
> --
>
>
>
>
>  *Bruno Cezar Rocha** - @rochacbruno*
> rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
> www.CursoDePython.com.br | www.rochacbruno.com.br
> Blog: Loading html elements dynamically with web2py and ajax
> 
>   Get a signature like this.
> 
>  Click
> here.
>
>
>
> On Mon, Aug 13, 2012 at 9:34 PM, Kevin Miller wrote:
>
>>
>> Hi All,
>>
>> Can I call custom functions in views? Functions that I have created in my
>> controller/default.py.
>>
>>
>>
>> Thanks.
>>
>> --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Functions in Views

2012-08-13 Thread Bruno Rocha
You only can call functions that are in global scope.

if you define function in /models/ so you can call those functions in
controllers and views.

If you defined in controller, so you have to return it to the view.

controller/default.py
---

def foo():
return "bar"

def index():
name = "Bruno"
form = FORM()
return dict(form=form, name=name, foo=foo)

--




 *Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Loading html elements dynamically with web2py and ajax

  Get a signature like this.

Click
here.



On Mon, Aug 13, 2012 at 9:34 PM, Kevin Miller wrote:

>
> Hi All,
>
> Can I call custom functions in views? Functions that I have created in my
> controller/default.py.
>
>
>
> Thanks.
>
> --
>
>
>
>

-- 





[web2py] Functions in Views

2012-08-13 Thread Kevin Miller
Hi All,

Can I call custom functions in views? Functions that I have created in my
controller/default.py.



Thanks.

--