[Cubicweb] Understanding _cw

aurélien campéas aurelien.campeas at gmail.com
Thu May 15 23:51:06 CEST 2014


>
>   class HelloView(View):
>       __regid__ 'hello'
>       __select__ = is_instance('IndexCard') & title('summary')
>
>       def render(self, cw, w, t, _, rset, *args, **kw):
>           with t.h1(_class=self.__regid__):
>               w(_('Hello, World, says %s' % cw.appli.name))
>           if cw.cnx.is_anonymous:
>               w(t.p('Register now and get a free cw !'))
>           cw.view('blogentry', rset)
>
>

This make me want to try:

  @view('hello', is_instance('IndexCard') & title('summary'))
  def render(self, cw, w, t, _, rset, *args, *kw):
      with t.h1(_class=self.__regid__):
          w(_('Hello, World, says %s' % cw.appli.name))
      if cw.cnx.is_anonymous:
          w(t.p('Register now and get a free cw !'))
      cw.view('blogentry', rset)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140515/01dfc545/attachment-0102.html>


More information about the Cubicweb mailing list