I recently dug into web2py and discovered how it decides which controller 
functions are exposed as endpoints.  I found that it does this with the 
find_exposed_functions function in compileapp, which uses a regex to 
textually search the source code of the controller file for lines of the 
form "def somefunc():" (at the beginning of the line).  I'm curious about 
the history and reasoning behind this decision.

To be frank, I was quite shocked to discover this.  It means that the 
determination of which functions are exposed is not programmatically 
manipulable -- that is, there is no way to use Python logic to expose 
things based on attributes, or to expose other callable objects, etc.

So I assume there must be some reason why things were done this way.  What 
are the advantages of determining function exposure textually, rather than 
executing the controller file in a namespace and then inspecting its live 
Python objects to determine which ones to expose?

-- 
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.

Reply via email to