You can access this from a servlet via self.request()
If you check the limited docs ( http://webware.sourceforge.net/Webware-0.8.1/WebKit/Docs/Source/Summaries/HTTPRequest.py.html
)
you will see a method called field.
so to get the value of page out of ShowPage?page=somefile.template
you would have some code like
def writeContent(self):
templateName = self.request().field('page','default.template')
templateFile=os.path.join(os.path.dirname(os.path.dirname(self.serverSidePath()))
,r'templates',templateName')
#templates are in AppWorkDir\templates
t = Template(file=templateFile, searchList=[self.getPageData()])
self.write(t)
By the same token anything that you would like to send back to the browser is in the Response object.
http://webware.sourceforge.net/Webware-0.8.1/WebKit/Docs/Source/Summaries/HTTPResponse.py.html
Calling self.write(t)
causes python to evaluate t as a string, and then pass that string to the write method and send
it to the browser
A nice Cheetah trick it to pass the servlets Response object to the cheetah templates respond method.
t.respond(trans=self.transaction())
This causes the results to be sent diretly from the template to the browser, rather then buffering it up in ram.
-Aaron
Read: http://webware.sourceforge.net/Papers/Python10.pdf http://webware.colorstudy.com/twiki/bin/view/Webware/TransactionAnatomy http://webware.sourceforge.net/Papers/IntroToWebware.html
Leith Parkin wrote:
G'day all,
Ive recently installed webware and have been having a play with it. I have managed to create a very very simple app that uses Cheetah templates to produce a static output. I would really love to extend this futher to handle forms and query string parameters. Reading the docs that come with the 0.8.1 (basically the class list) i am a little confused. Once i get a good handle on webware i intend to replace a intranet system at my workplace which currently runs as a lot of cgi scripts into some sort of unified application.
I dont have a overly strong grasp on pythons OO, and am quite new to this idea of application servers, so am i little confused as to what methods one needs to override to provide functionality for say a servelet that is called as ShowPage?page=somefile.template . A quick search on google has given a few pages, but they seem to jump over what seems to me a pretty basic concept?
Could someone please point me to a beginners guide that explains simple concepts like this?
Thanks
Leith
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
-- -Aaron http://www.MetroNY.com/ "I don't know what's wrong with my television set. I was getting C-Span and the Home Shopping Network on the same station. I actually bought a congressman." - Bruce Baum
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
