开发者

Template tags like Django with Mako and Pylons

For my site need some "widgets" that elaborate output from vario开发者_开发知识库us data models, because this widgets are visible in any page is possible with mako to retrieve the data without pass (and elaborate) every time with render() in controllers?


May be you need use helpers

in lib/helpers.py

def tweets(**params):
   context = {}
   return render('tweets.mako', context)

In you page template do this to render you tweets widget:

   h.tweets()


It sounds like you're looking for some combination of FormAlchemy, ToscaWidgets and/or Sprox. I would check out those three.
Also, you might read Chapter 6 of http://pylonsbook.com/en/1.1/ . It helped me a bunch; maybe you'll get something out of it as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜