473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Web Framework Reviews

Hello All,

I thought it would make sense to write up some of my experiences with
python based web frameworks:

http://www.personal.psu.edu/staff/i/...n_reviews.html

best,

Istvan.

Jul 21 '05 #1
13 1976
is***********@gmail.com <is***********@gmail.com> wrote:
I thought it would make sense to write up some of my experiences with
python based web frameworks:

http://www.personal.psu.edu/staff/i/...n_reviews.html


You've never used Nevow, have you?
Comparing it to Cheetah or ZPT means that you never used it.

Nevow is exactly what you define as a web framework, and it would be
quite interesting to know why you didn't put it in that section.

--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
Jul 21 '05 #2
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.

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.

To avoid any negative feelings I'll remove all remarks to what I think
is not a web framework.

Istvan.

Jul 21 '05 #3
is***********@gmail.com <is***********@gmail.com> 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/retu..._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
Jul 21 '05 #4
On 2005-07-19, is***********@gmail.com <is***********@gmail.com> wrote:
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.


Take a look at the Nevow FAQ and examples. Also, Nevow sits on top of
Twisted, so you have all of Twisted's features available.

http://divmod.org/users/wiki.twistd/...AskedQuestions

Dave Cook
Jul 21 '05 #5
> 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


I think you should take what you posted above and put it up on your
main site, because right now there is no way to find any information
like this. Your entire intro is about templating and leaves one with
no clues as to what else is there.

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.

Thanks for the explanations.

Istvan.

Jul 21 '05 #6
is***********@gmail.com <is***********@gmail.com> wrote:
I think you should take what you posted above and put it up on your
main site, because right now there is no way to find any information
like this. Your entire intro is about templating and leaves one with
no clues as to what else is there.
Right now there are at least 2 web sites:
http://divmod.org/users/exarkun/nevow-api/ + file inevow.py in nevow.
http://divmod.org/users/mg/nevow-doc/

And a new one:
http://dictator.kieranholland.com/pr...et%20Stan.html

And the page I linked in my previous post:
http://nevowexamples.adytum.us/
this is a living site with the living examples distributed with nevow.
at least one example of formless does not work right now because of
changes that we are doing in trunk right now (only formless has some
problems, all the others work pretty well).

There are really a lot of examples, and you can learn a lot of stuff
from them. More documentation will be useful for sure, but by just
coming in the irc channel #twisted.web on freenode you would have
obtained all the answers you wanted to write a better review paper :).
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.
I have a little project, developed during my little free time that is
linked in my signature (weever). It has over 2000 lines of xhtml
templates and you can see a living example here:
http://vercingetorix.dyndns.org:20080/

I can guarantee you that when templates begin to be a bit too complex
stan is what saves the day. I usually use xhtml for everything (and
nevow has the best templating engine out there thanks to its flexibility
and simplicity, there are only 3 special tags and 3 attributes, and we
are working to make it even easier than that) but when xhtml gets
complicated stan is incredibly useful.

Anyway stan is also incredibly useful to write little examples without
requiring a new xhtml file (ok... you may use loaders.xmlstr but...)

And it does scale well anyway (Quotient is entirely built using stan and
it's very big).
Templating engines like ZPT prefer to put some code in the template,
Nevow prefers to put code in python and allow you to write some xhtml in
python too. python is easier to manage and less likely to be screwed by
any designer that doesn't know what python is.
Thanks for the explanations.


np :)

--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
Jul 21 '05 #7
is***********@gmail.com wrote:
I thought it would make sense to write up some of my experiences with
python based web frameworks:

http://www.personal.psu.edu/staff/i/...n_reviews.html


From the web-page:

"""
Zope - Generation Z

....

Weakness: Not pythonic. In fact you can barely use python with it!
Ad-hoc lookup rules, competing standards DHTML vs ZPT. Can only be used
with these two! The Z shaped thingy.

"""

"barely use python with it" and "can only be used with these two" are
not entirely true. Zope development can be done in a through-the-web
(TTW) fashion or via filesystem products. When developing TTW, it
is true that you are somewhat limited in the amount of Python that
you will be able to use.

When you graduate to filesystem products, though, Zope becomes more of
a set of APIs and a persistence layer for your objects and methods
that are coded entirely in Python, with very little DTML (not DHTML)
and ZPTs. IMHO, this is when Zope development becomes powerful.

Maybe this is the Z-shaped learning curve you speak of: it takes a
while developing in Zope to even know what all of the options are!

HTH,
JZ
Jul 21 '05 #8
> "barely use python with it" and "can only be used with these two" are
not entirely true. Zope development can be done in a through-the-web
(TTW) fashion or via filesystem products. When developing TTW, it
is true that you are somewhat limited in the amount of Python that
you will be able to use.

I just want to add that ZPT and DTML are only intended for the
presentation and not for the logic, which can be done all using python.
However, as you may see, there are some zope developers that use it
wrong and do lots of logic stuff within dtml or zpt.

Regards,
Josef

Jul 21 '05 #9
is***********@gmail.com 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(val ue))]
else:
yield T.p[value]
else:
yield T.p[T.strong['nothing uploaded']]

yield T.input(name=namer('value'),value=value,type='hidd en')
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
Jul 21 '05 #10
> don't see why this would have problems 'scaling' or would be
more difficult to visualise than a the equivalent tag soup html.
I think the difficulties will arise from the inability to visually
track closing tags.
]]] versus </tr></tr></table>
Templating engines like ZPT prefer to put some code in the template,
Nevow prefers to put code in python and allow you to write some xhtml in
python too.


Oh yeah, now I remeber, I think this is a controversial idea.

Istvan.

Jul 21 '05 #11
is***********@gmail.com <is***********@gmail.com> wrote:
I think the difficulties will arise from the inability to visually
track closing tags.
]]] versus </tr></tr></table>


You can do things like:

t.html[
t.head[
t.title["Foobar"]
],
t.body[
t.p["This is some content"]
]
]

This is not harder than normal xhtml tags to follow. plus you don't have
to remember what tag you are closing :)

--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
Jul 21 '05 #12
is***********@gmail.com wrote:
Templating engines like ZPT prefer to put some code in the template,
Nevow prefers to put code in python and allow you to write some xhtml in
python too.


Oh yeah, now I remeber, I think this is a controversial idea.


One important thing to realise about Nevow is that it doesn't forbid you
from putting logic in the template, it simply doesn't encourage it.
There's nothing stopping you from writing render_while and render_if
methods for Nevow -- in fact, it would be quite easy. But once you
really understand Nevow and how it works, you realize that you don't
need to put logic in the template, because there's a better way.
Jul 21 '05 #13
Dave Cook wrote:
On 2005-07-19, is***********@gmail.com <is***********@gmail.com> wrote:

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.

Take a look at the Nevow FAQ and examples. Also, Nevow sits on top of
Twisted, so you have all of Twisted's features available.

http://divmod.org/users/wiki.twistd/...AskedQuestions

Dave Cook


One could use twisted.web2 also without the nevow part.
The docs @ http://twistedmatrix.com/projects/web2/documentation/ are
very clear and it contains a good example at the end.

Benedict
Jul 21 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: gonzalo briceno | last post by:
I have been using phplib for a while and I really like the framework except for form creation. Maybe it is me but I in my opinion there isn't a good way to create forms or should I say, everything...
10
by: Buck Rogers | last post by:
Hi guys! Does anyone have a link to a site that provides up to date programming book reviews? I looked through the reviews at: http://www.accu.org/bookreviews/public/index.htm ...
16
by: John A. Bailo | last post by:
I was pricing VS.NET Professional 2005 upgrade and found a good price on Amazon -- but then I read the customer reviews and they were terrible: ...
0
by: MiniMe | last post by:
Microsoft .NET Framework 1.1 Class Library Reference Volumes 1-4 are for sale These books have never been used, but they are not sealed. There is some minor shelf wear due to simply handling the...
0
by: hazemtorab | last post by:
Ajax Projects is a portal for all ajax resources. it includes reviews for most of the toolkits and frameworks. it will help you to have the decision which framework or toolkit you will use in your...
0
by: felics60 | last post by:
Lack of knowledge about computers and its accessories is a big problem if one doesn't know their subtleties and intricacies. I have been searching for these informations lately and I found that one...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
6
by: =?Utf-8?B?Vk1J?= | last post by:
Where can I find aspnet web host reviews? There aren't many sites that list user reviews for asp.net web hosting. I've seen some, but it seems that they don't update the site (ie. their most...
0
by: cnb | last post by:
class Customer(object): def __init__(self, idnumber, review): self.idnumber = idnumber self.reviews = def addReview(self, review): self.reviews.append(review) def averageGrade(self): tot...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.