"Private" controller functions

415 views
Skip to first unread message

Markus Gritsch

unread,
Jan 2, 2008, 4:18:45 PM1/2/08
to gl...@googlegroups.com
Hi,

currently all functions in a controller are exposed. How about only
exposing a functions if its name does not start with an underscore, or
does not start with two underscores?

Markus

Massimo Di Pierro

unread,
Jan 2, 2008, 4:19:47 PM1/2/08
to gl...@googlegroups.com
Functions that take arguments are not exposed.

Markus Gritsch

unread,
Jan 2, 2008, 4:26:40 PM1/2/08
to gl...@googlegroups.com
On 02/01/2008, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:
>
> Functions that take arguments are not exposed.

ah, thank you

Markus

Sheidaev Vidadi

unread,
Oct 13, 2016, 9:28:44 PM10/13/16
to web2py-users, gl...@googlegroups.com, m.gr...@gmail.com
As of 2016, here's some info from https://web2py.wordpress.com/tag/private-function/:

  • Making a private function is easy in web2py :
  • Functions defined in a model are private.
  • Functions that are defined in controllers and that takes arguments are private.
  • Functions defined in controllers and start with ‘__’ [double underscores] are private.
    But functions starting with single ‘_’ are not private and they should not be because some people use them for an ajax callback.
  • Functions defined in controllers and having a space after the () and before the ‘:’ are private.
    ex:

    1
    2
    def pri_action() :
    # do some thing

Reply all
Reply to author
Forward
0 new messages