[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have not used Nevow but I have seen a few examples of how it works > and I kept track of it over the years. > > It used to be very similar to how Cheetah or ZPT does its job. You had > a template, and you filled it with data to produce an output. It seems > that it has now more features such a form submission and validation.
Formless has been part of nevow since the very beginning. It has also been part of woven (Nevow predecessor), just like liveevil (now enhanced and called livepage). The only part of nevow that you can compare to ZPT or Cheetah is its xmlfile template language. There is no way you can run Nevow on top of any other framework. Also you don't pass data to the templating engine. It's nevow that parses the template and iterates over it to render the page. The template is very stupid in nevow and everything is done in nevow.flat.flattenFactory called by nevow.rend.Page. > On the other hand I even in its current form I don't see how I would to > the simple things that I need every day. Create a session, set a > cookie, redirect to another url, perform HTTP autentication, create > filter, use another templating language? This is also integral part of > the functionality that I expect from an web framework. Web specific > things exposed in some python ic way. Sessions are handled by default with twisted.web: from twisted.application import service, strports from nevow import appserver from nevow import rend, loaders, tags as t, inevow class RootPage(rend.Page): addSlash = True def display_session(self, ctx, data): return inevow.ISession(ctx).uid docFactory = loaders.stan( t.html[t.head[t.title["Session example"]], t.body[display_session]] ) application = service.Application('Foobar') site = appserver.NevowSite(RootPage()) server = strports.service('8080', site) server.setServiceParent(application) Save this in a .py or .tac and run it with twistd -noy filename.tac/.py and open http://localhost:8080/ in your browser to see your session uid. If you want autentication: http://nevowexamples.adytum.us/sources/guarded.py http://nevowexamples.adytum.us/sources/guarded2.py There are 2 examples (in the standard nevow distribution) that show how to handle authentication in an application transparent way (you don't have to touch your application by any means to add user authentication, which means you can write everything without taking care of this aspect of the app and then add it later). To redirect to another url just call IRequest(ctx).redirect(newurl) before the rendering begins (like in rend.Page.beforeRender) or in rend.Page.locateChild. HTTPAuthentication is easily handled: http://nevowexamples.adytum.us/sources/http_auth.py just use that class as a base class for your blocked page. (this example is part of the standard nevow distribution). Nevow doesn't have filters because they are handled by twisted.web or twisted.web2 (which is, hopefully soon, going to be one of the required webservers to run nevow, the others are lighttpd, apache, any WSGI application server, nevow was in fact the first framework to support WSGI servers). If you want to use a different templating language you just need to write a custom loader. Somebody did this in the past (I don't recall the url of the project) that used cheetah-like templates. Then for the last point: you can expose directories or files using nevow.static.File exposed objects are: those set as a value in rend.Page.children dict, you can reach them with an url like: http://www.example.com/url/that/returns/a/page/inst/key_in_children_dict Or assign an object to a child_foobar attribute like: p = rend.Page() p.child_foobar = static.File('/etc/') Or return an object from a child_foobar method. Or override rend.Page.childFactory(self, ctx, segment) to return an object in a dynamic way depending on the value of the segment argument. It seems to me that you really never tracked Nevow, your information is very incomplete. I think you should complete it before talking about Nevow :). -- Valentino Volonghi aka Dialtone Now Running MacOSX 10.4 Blog: http://vvolonghi.blogspot.com http://weever.berlios.de -- http://mail.python.org/mailman/listinfo/python-list