From: <jo...@cy...> - 2003-08-29 00:54:26
|
take a look at tplCompiler for webware http://mbp.compmed.ucdavis.edu/tplcompiler Jose > -------- Original Message -------- > Subject: Re: [Webware-discuss] Including a PSP file from a Servlet > From: web...@ka... > Date: Thu, August 28, 2003 2:25 pm > To: web...@li... > > --> Thursday, August 28, 2003, 1:55:12 PM, web...@ka... > wrote: > > > Can I include a PSP file from my Servlet? I am guessing this seems a > bit > > backwards, but not to me. > > Ok, I want to use PSP as a template language I can include in my > Servlet. > > I have the following in a Servlet subclassed by a bunch of PSP pages. > > ########################################################################### > > def writeContent(self): > self.writeLayout() > > def writeLayout(self): > > #------------------------------------------------------------------------ > self.write( > ''' > <table border=1 width=100%%> > <tr> > <td>%s:</td> > <td> > <div align=center> > some links > </div> > </td> > </tr> > <tr> > <td> > this will be the branch menu > </td> > <td> > some more links > </td> > </tr> > <tr> > <td>stuff</td> > <td>stuff</td> > </tr> > </table> > <table border=1 width=100%%> > <tr> > <td> > ''' > % (self.thing) > ) > > #------------------------------------------------------------------------ > self.writeMyPage(self) > > #------------------------------------------------------------------------ > self.write( > ''' > </td> > </tr> > </table> > ''' > ) > > #------------------------------------------------------------------------ > > def writeMyPage(self): > self.write(' This MyPage has not yet been written <br>') > > ########################################################################### > # ( PSP pages are overriding writeMyPage ) > > Now, I hate the writeLayout method as I've implemented it here. I would > love > for writeLayout to look *something* _like_ this instead... > > def writeLayout(self): > self.include('./MyPageHeader.psp') > self.writeMyPage(self) > self.include('./MyPageFooter.psp') > # even if this means I am using a psp superset, .pst or something. > # ( .pst for Python Server Template... *shrug* ) > > Or likely something more evolved than that, probably not separating > header > and footer. Anyway, you should be able to see what I want to do; use > PSP as > a templating language. Can I do this? I imagine it might be tricky > since PSP > are compiled to servlets and this itself is a servlet. > > What other options exist for making writeLayout more manageable? > > I don't like any of the templating languages like Cheetah, etc, because > many > of those are too similar to PHP + c-preprocessor for my tastes, with > things > like $variables and #directives or whatnot. > > -Kai > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Webware-discuss mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss |
From: Geoffrey T. <gta...@na...> - 2003-08-29 13:35:22
|
web...@ka... wrote: > Can I include a PSP file from my Servlet? I am guessing this seems a > bit backwards, but not to me. I find using the PSP files as my base > strange. You can use self.includeURL('SomePSP') to include the contents of a PSP. - Geoff |
From: <web...@ka...> - 2003-08-29 15:23:12
|
--> Friday, August 29, 2003, 8:35:12 AM, gta...@na... wrote: > web...@ka... wrote: >> Can I include a PSP file from my Servlet? I am guessing this seems a >> bit backwards, but not to me. I find using the PSP files as my base >> strange. > You can use self.includeURL('SomePSP') to include the contents of a PSP. Doh, I planned to use this for including the contents of another web development platform. I didn't think to use it for PSP. Is there any performance/scalability concern with this? -Kai |
From: Geoffrey T. <gta...@na...> - 2003-08-29 15:27:16
|
web...@ka... wrote: > --> Friday, August 29, 2003, 8:35:12 AM, > gta...@na... wrote: > >> web...@ka... wrote: >>> Can I include a PSP file from my Servlet? I am guessing this seems a >>> bit backwards, but not to me. I find using the PSP files as my base >>> strange. > >> You can use self.includeURL('SomePSP') to include the contents of a >> PSP. > > Doh, I planned to use this for including the contents of another web > development platform. I didn't think to use it for PSP. Is there any > performance/scalability concern with this? > > -Kai It won't work for including the contents of another web development platform. It only works for including other Servlets or PSPs within the same WebKit process. I don't think performance will be a problem. I think you'd have to use urllib to suck in the contents from another web dev platform. - Geoff |
From: <web...@ka...> - 2003-08-29 04:10:00
|
--> Thursday, August 28, 2003, 7:53:57 PM, jo...@cy... wrote: > take a look at tplCompiler for webware > http://mbp.compmed.ucdavis.edu/tplcompiler > Jose Thanks for the recommendation, but that's not quite it. I'd use "%(somevar)s" % vars() if I wanted something like that. I am looking for something a little more flexible and a little more python. Ideally I'd just like to 'include' a PSP page. Should this be possible with the PSP compiler somehow? -Kai |