This works but it makes me add *@expose('json')* to every method.

In fact, i would like to do something like this:

class MyController(BaseController):
    @expose('some_template.html')
    def foo(self):
          return dict(a=1, b=2)

my_controller = MyController()
response = my_controller.foo()
# test values inside "response" dict

but it's not possible, at least directly

León Domingo

Ender - Factoría de Software
[email protected] <[email protected]>
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01

<http://www.ender.es/>
<http://www.facebook.com/home.php?#%21/pages/San-Sebastian-de-los-Reyes-Spain/Ender-Factoria-de-Software/142213119143359?ref=ts>
* <http://www.ender.es>*


On 4 May 2012 00:17, Moritz Schlarb <[email protected]> wrote:

> You could expose it as json, which would just render the objects from the
> dict you return.
>
> E.g.
> @expose('json')
> def func(self):
>     return dict(a='blah')
>
> would let you access: /func.json and get:
> {"a": "blah"}
>
> Does that help you?
>
> Am Donnerstag, 3. Mai 2012 23:13:30 UTC+2 schrieb León Domingo:
>
>> Hi guys,
>> I'm begging to testing with TG and a question comes up.
>>
>> WebTest allows us to get the response from a particular URL but that
>> response is the rendered version, the associated template + returning dict
>> from the controller.
>> Is there a way to get only the dict returned by the controller? My idea
>> is to test the "web side" with Selenium, so the dict is the only
>> information I need at this moment.
>>
>> Thanks in advance
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/q3dXOVUkS08J.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to