I'm trying to determine how to call a Kid template from within my  
python application code.  I've tried to do this with the following  
simple example with no luck:

======Main.py======
from WebKit.Page import Page
from kid import Template
import time

class Main(Page):
     def title(self):
         return 'Test Foo'

     def writeContent(self):
         t = Template(file = 'time.kid', title = self.title(),  
time_now = time.ctime())
         html_out = t.serialize(output='xhtml-strict')
         self.write(html_out)

======time.kid======
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml";
       xmlns:py="http://purl.org/kid/ns#";>
   <head>
     <title py:content="title">
       This is replaced with the value of the title variable.
     </title>
   </head>
   <body>
     <p>
       The current time is ${time_now}.
     </p>
   </body>
</html>


However, I receive the following traceback:

NameError: name 'title' is not defined
Error location in template file '/Users/techniq/Documents/Code/Python/ 
Webware/Loto/time.kid'
between line 5, column 4 and line 8, column 2:
     <title py:content="title">
       This is replaced with the value of the title variable.
     </title>


Any ideas on how to make this work?  In the python interpreter this  
works just fine.

Webware = 0.9.2
Kid = 0.9.6a

Thanks in advance.
___________________
John Ruff
[EMAIL PROTECTED]
GPG Key: 0x1F691195
FGPR: 6B50 37C9 10F9 6C4A D381  54B8 319D 7DD9 1F69 1195

"No one can see past a choice they don't understand." --The Oracle



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to