[EMAIL PROTECTED] wrote: > One remark regarding stan. For me it is inconceivable that one would > build (and debug) any complicated webpage as stan does it, one element > at a time: > > docFactory = loaders.stan( > t.html[t.head[t.title["Session example"]], > t.body[display_session]] > ) > > The pages that I have to build invariably contain multiple nested html > tables etc. I shudder to think that I would ever have to build them > like that. I know you have an "inverse" ZPT like templates those are a > lot friendlier on the eyes. For someone who is does not know what Nevow > is seeing an example of Stan is very scary because IMO it does not > scale at all. This again is just an opinion.
Firstly, I don't know of anyone who has built whole sites out of stan (it's not what it was created for). Although if built in a modular fashion I don't see why this would have problems 'scaling' or would be more difficult to visualise than a the equivalent tag soup html. Also it depends on what you mean by scale. We built a site for one of the biggest rugby sites in the world (over 300 requests per second). This uses a combination of stan and xhtml templates. Before we rebuilt the site using CSS layout (which you really should be looking at using to avoid the multiple nested tables you mention - which I presume are layout related) we were using client supplied html which was nested more than 10 levels deep. Most of this we were able to leave in the html and allow the client to manage via ftp. The bits that were dynamic were 'templated up' by putting slots and renderers. Nevow avoids any programmatic logic in the templates which means that all logic is directly in your python code (avoiding one of templating languages biggest faults - that of implementing *another* language just for templates). Templates now become a repository of html which is marked up with insert points, replacement points, patterns to reuse, etc. Sometimes you need to generate some dynamic html that won't easily and clearly fit into this 'extract patterns, replace sections, etc' pattern. When this happens you can either include bits of html as strings (yeuch!) *or* use stan. Stan enables you to create small sections of dynamic html without recourse to templating languages or marking up tiny fragments of html for re-use. This section of code from the nevow forms library (this is a widget for file uploads). if name: if self.preview == 'image': yield T.p[value,T.img(src=self.fileHandler.getUrlForFile(value))] else: yield T.p[value] else: yield T.p[T.strong['nothing uploaded']] yield T.input(name=namer('value'),value=value,type='hidden') yield T.input(name=key, id=keytocssid(ctx.key),type='file') In other systems, this would have to be part of the template (via inline python or some alternative programming syntax), marked up as html in string elements (liable to validation errors and difficult to manage) or small fragments of html would have to be marked up as patterns and then manipulated in some fashion. The last is possible using nevow and the manipulation can be done directly on the produced html -- or via stan!! (think of manipulating a dom'ish like object). Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list