ANN: QWeb, a python framework to build web applications quickly

Can you imagine a day without a new python web framework ? QWeb is Yet an another web framework (WSGI compatible). This one is in the spirit of web.py (http://webpy.org/) URL: http://antony.lesuisse.org/qweb/trac/ It provides: * A lightweight request handler (QWebRequest) * An xml templating engine (QWebXml and QWebHtml) * A simple name based controler (qweb_control) * A standalone WSGI Server (QWebWSGIServer) * A cgi and fastcgi WSGI wrapper (taken from flup) * A startup function that starts cgi, factgi or standalone according to the evironement (qweb_autorun). The templating system (that can be used independently) is IMHO superior to everything else. It looks like kid or ZPT. It takes pure XML to generate any kind of textual output (valid or non valid xml). It's very simple and extensible. QWebHtml is an extension of the basic templates that support urls and forms. The example blog shows how to use the templates: http://antony.lesuisse.org/qweb/files/QWeb-0.5-blog.tar.gz It's a small blog engine with comments made of 2 files. It uses sqlobject and sqlite as backend. blog.py 131 lines long (model and controller) template.xml 380 lines long (views 6 templates) The demo example illustrate the use of the request object and static component: http://antony.lesuisse.org/qweb/files/QWeb-0.5-demo.tar.gz Helloworld ---------- import qweb def helloapp(environ, start_response): req = qweb.QWebRequest(environ, start_response) req.response_headers['Content-type'] = 'text/plain' req.write('Hello World') return req if __name__ == '__main__': qweb.qweb_wsgi_autorun(helloapp) Example template: ----------------- <t t-name="democall"> democall called, <br/> <t t-esc="0"/> <br/> <t t-esc="arg1"/> <br/> <t t-esc="arg2"/> <br/> </t> <t t-name="demo_template"> <h2>The QWebXml and QWebHTML templating system</h2> <pre> Basic tags: t-raw t-esc t-if t-foreach t-call t-set t-trim </pre> <a t-att-class="varname">test</a> <t t-raw="varname"/> <t t-esc="varname"/> <t t-if="1==2">KO</t> <t t-if="1!=2">OK</t> <t t-call="democall"> <t t-set="arg1">the value of arg1</t> <t t-set="arg2" t-eval="2+2"/> body of the call </t> <t t-foreach="range(10)" t-as="i"> i= <t t-esc="i"/><br/> </t> </t> Usage of template: ------------------ import qweb t=qweb.QWebHtml('file.xml') t.render("demo_template",{'varname':"some text with a tag <tag>"})
participants (1)
-
Antony Lesuisse