On Sunday, March 15, 2015 at 3:25:27 PM UTC-4, Alex Glaros wrote:
>
> in this case one of the functions is sending me an email notifying me that
> a user has logged on.
>
You can call any function that is in the same controller (just call the
function, don't use URL()). But if those functions are actions that return
dictionaries to pass to views, you may be running unnecessary code if you
really just need some side effect of the function. If you want to send an
email, maybe create a separate function that sends emails (not an "action",
but a helper function). Then call that helper function from within any
function that needs to send emails.
So, instead of:
def action1():
[do something]
[mail setup code]
mail.send(....)
return dict(...)
def action2():
action1()
redirect(...)
You can do:
def send_emails(...):
[mail setup code]
mail.send(...)
def action1():
[do something]
send_emails(....)
return dict(...)
def action2():
send_emails()
redirect(...)
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.