You quickstarted the project with the Mako template engine (you got
master.mak) and then you are writing there a Genshi template, it's quite
comprehensible that mako doesn't understand much of that.

On Wed, Mar 13, 2013 at 3:45 PM, Dmitry Kolesov <[email protected]> wrote:

> Hello.
> I am trying get data from MySQL database.
> I have created model.py in model directory with content:
>
> __all__ = [ 'Table1' ]
>
> class Table1(DeclarativeBase):
>     __tablename__ = 'table1'
>
>     id = Column(Integer, primary_key=True)
>     data = Column(Unicode, nullable=True)
>
> I have changed controllers/root.py:
>
>   @expose('tg2app.templates.index')
>     def index(self):
>         """Handle the front-page."""
>         tabledata = DBSession.query(Table1).all()
>         datalen = len(tabledata)
>         return dict(datalen=datalen, tabledata = tabledata,)
>
>
> And I have changed templane master.mak:
>
>   <div class="currentpage">
>       Rows count: <span>${datalen}</span>
>   </div>
>   <div py:for="data in tabledata">
>        <p py:content="data">Text</p>
>   </div>
>
>
> And I have error in the log when I open page:
>
> [Tue Mar 12 22:34:40 2013] [error] [client 127.3.133.129]
> __M_writer(escape(d))
> [Tue Mar 12 22:34:40 2013] [error] [client 127.3.133.129] File
> '/var/lib/openshift/517500009a/python-2.6/virtenv/lib/python2.6/site-packages/Mako-0.7.3-py2.6.egg/mako/runtime.py',
> line 194 in __str__
> [Tue Mar 12 22:34:40 2013] [error] [client 127.3.133.129]   raise
> NameError("Undefined")
> [Tue Mar 12 22:34:40 2013] [error] [client 127.3.133.129] NameError:
> Undefined
>
> If I comment string "<p py:content="data">Text</p>" in the template
> master.mak, all work fine.
> And variable "datalen" contains correct value.
>
> What is wrong?
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to