Menu Chiudi

H T M L Based Template Example

This is the python code:

This is the python code:

class ISearch(TypedInterface):
def doSearch(self, str=String()): pass
doSearch = autocallable(doSearch)


class IChat(TypedInterface):
def doChat(self, msg=String()): pass
doChat = autocallable(doChat)


class MyPage(rend.Page):
__implements__ = ISearch, IChat, rend.Page.__implements__

def doChat(self, msg):
print "chat!"

def doSearch(self, str):
print "search!"

def render_searchForm(self, context, data):
return webform.renderForms(bindingNames=['doSearch'])

def render_chatForm(self, context, data):
return webform.renderForms(bindingNames=['doChat'])

this is the html template:

<html>
<form nevow:render="searchForm"/>
some text
<form nevow:render="chatForm"/>
</html>
WordPress Appliance - Powered by TurnKey Linux