It should list decorated functions, but it won't be limited to decorated 
functions. If you only want to list service decorated functions, you'll 
need your own custom regex:

import re
regex_expose = 
re.compile('^@service\.[a-z]+\ndef\s+(?P<name>_?[a-zA-Z0-9]\w*)\( 
*\)\s*:', flags=re.M)

Another option is to have one or more controllers that only contain service 
functions so you don't have to bother making the distinction with the regex.

Anthony

On Monday, February 25, 2013 9:03:21 AM UTC-5, frasse wrote:
>
> Thanks Anthony
> It works for methods which not exposed as service but not method like this
>
>
> @service.json
>> def echo(data):
>>     return data
>
>
> /F 
>
> 2013/2/25 Anthony <[email protected] <javascript:>>
>
>> Here's how the admin app does it:
>>
>> import os
>> from gluon.myregex import regex_expose
>> mycontroller = open(os.path.join(request.folder, 'controllers', 
>> 'mycontroller.py'), 'rb').read()
>> exposed_functions = regex_expose.findall(mycontroller)
>>
>> Anthony
>>
>>
>> On Monday, February 25, 2013 4:40:01 AM UTC-5, frasse wrote:
>>>
>>> Hi
>>> I like to have a method to returns a list of all exposed methods in a 
>>> controller so it can be use in a view. I want to build a information 
>>> webpage for service consumers (xmlRpc , Json .....) that  can be 
>>> updated when I add /update/ remove new service to my application API. Can 
>>> web2py do it for me ?
>>>
>>> Thanks
>>> /F
>>>
>>  -- 
>>  
>> --- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to