If self.product is only used for the title then putting the code in def title is reasonable.

Personally I use awake for any pre-content info that needs to exist so the page can render properly.
Things like user, theme, are put together here. You may want to add a getPageData type function at the end of yout SitePage.awake() and then customize that per servlet.


webware-discuss@kaishaku.org wrote:
--> Wednesday, August 27, 2003, 6:28:13 PM, webware-discuss@kaishaku.org wrote:

I found myself doing this... but felt it was flawed.

  def title(self):
    self.product = self.request().uri().split('/')[1]  

One thing I do quite often is use directory structures and filenames as
implementation specific data whenever I can. In this case, the title will
include the product name, which is the folder name.

Am I supposed to do this instead?

  def awake(self,transaction):
    self.product = self.transaction().request().uri().split('/')[1]  

This is a question of where I am supposed to put code I would normally put
in the class constructor but cannot since the good stuff, response/request,
of the Servlet is not defined at that point.

Is awake the right place for init/global/preprocessing code?


This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
Webware-discuss mailing list

"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