def filter(d): import re if isinstance(d,dict): return re.compile('\n\s\s+\n').sub('\n',response.render(d)) return re.compile('\n\s\s+\n').sub('\n',response.render(d())) response._caller=filter
Just place the snippet above in your controller code or in your model code. If in the controller, it filters the output of that controller. If in the model code, it filters the entire app. I have seen no errors, and the speed difference should be vanishingly small. The code output has a hand-crafted appearance, at least for views written with my style. karl On Dec 15, 12:55 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > On Dec 15, 2009, at 12:08 PM, Alex Fanjul wrote: > > > Hello Kbochert, it seems you found out a way to make cleaner output, do > > you get it working automatically? (ie. with out manual action for output > > clean process) > > I'm thinking in alway pass dictionaris throught filter function so > > instead of return dict we'd return filter(dict) but I'm not sure if it > > would be right. > > Could you give me the steps or snippet example to achieve this? > > > Finally, did you find any disadventages doing this? errors, slower > > speed, etc... > > I think it might be most useful to filter the entire page content, after it's > composed, but before it's delivered. Say a filter function, by default None, > in response, that gets called just before delivering the page, if the > content-type is appropriate. > > > > > Thanks a lot, > > Alex F > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.