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
jestrella@...
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01
On 4 May 2012 00:17, Moritz Schlarb
<mail@...> 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.
--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to
turbogears@....
To unsubscribe from this group, send email to
turbogears+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.