[Twisted-web] Should data passed to data_ methods be adapted via IGetable?

Kieran Holland kieran.holland at gmail.com
Tue Jul 5 20:16:41 MDT 2005


Is this expected behaviour?

----------------------

from nevow import loaders, rend, tags as T

class TestPage(rend.Page):
   docFactory = loaders.stan(
       T.html(data=T.directive('showdata'), render=T.directive('showdata'))
   )
   def data_showdata(self, context, data):
       print 'data_showdata:', data
       return data
   def render_showdata(self, context, data):
       print 'render_showdata: ', data
page = TestPage([1,2,3])
page.renderSynchronously()

---------------------

Output:

data_showdata: <__main__.TestPage object at 0xb72bad4c>
render_showdata:  [1, 2, 3]

I had expected that the data passed to the data_ method would be
adapted via IGettable, for consistency between corresponding data_ and
render_ methods.  But perhaps there is a good reason for this
behaviour which is not obvious to me?

Kieran



More information about the Twisted-web mailing list