Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1989 (closed defect: worksforme)

Opened 11 years ago

Last modified 10 years ago

Stacked @expose() does not work

Reported by: h2o Owned by: anonymous
Priority: normal Milestone:
Component: TurboGears Version: trunk
Severity: major Keywords:


According to the documentation for expose and the examples in the current 2.0 wiki one should be able to stack multiple @expose on a function like this:

@expose("myapp.templates.test", content_type="text/html")
def testcase(self):
	mylist = ["Hello", "World"]
	return dict(mylist=mylist)

But, trying to fetch the data I can only get the HTML version. If I remove the @expose for the template, then I do get json data without any problem. But when both are present it does not work!

I did the requests using jQuery and the headers looked like this:

Response headers

Server	PasteWSGIServer/0.5 Python/2.5.2
Date	Tue, 16 Sep 2008 13:45:30 GMT
Pragma	no-cache
Cache-Control	no-cache
Content-Type	text/html; charset=utf-8
Content-Length	1141

Request Headers

Host	localhost:8080
User-Agent	Mozilla/5.0 (X11; U; Linux i686; en-GB; rv: Gecko/2008072820 Firefox/3.0.1
Accept	application/json, text/javascript, */*
Accept-Language	sv,en;q=0.7,en-us;q=0.3
Accept-Encoding	gzip,deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive	300
Connection	keep-alive
X-Requested-With	XMLHttpRequest
Referer	http://localhost:8080/testcase
Cookie	session_id=0.348120876898; filter=; category=; torrent_info_tab=details; beaker.session.id=8009b7da4e77a375fef5d6c7160c0a09

Change History

comment:1 Changed 11 years ago by h2o

  • Milestone changed from 2.0 to 1.9.7a4

comment:2 Changed 11 years ago by mramm

Hmm, we have tests for stacked expose and they are passing. Can anyone reproduce this?

comment:3 Changed 11 years ago by mramm

  • Status changed from new to closed
  • Resolution set to worksforme

If anybody can reproduce this, please reopen the ticket.

comment:4 Changed 10 years ago by anonymous

  • Milestone 1.9.7a4 deleted

Milestone 1.9.7a4 deleted

Note: See TracTickets for help on using tickets.