A critique of cgi.escape

Jon Ribbens jon+usenet at unequivocal.co.uk
Tue Sep 26 12:40:02 EDT 2006


In article <mailman.708.1159287078.10491.python-list at python.org>, Brian Quinlan wrote:
> Well, there are dozens (hundreds?) of templating systems for Python. 

I know, I wrote one of them ;-)

> t = Template("test.html")
> t['foo'] = 'Brian -> "Hi!"'
> assert str(t) == '<p>Brian -> "Hi"</p>'
> 
> So how would you test our template system?

What I don't get is why you are testing the above code like that at
all. Surely if the template system somehow became so broken that it
couldn't even do trivial replacements, you would notice immediately
as all your web pages would go totally wrong.

> Maybe, which is why I'm asking you how you do it. Some of our web 
> applications contain 100s of script generated pages. Testing each one by 
> hand after making a change would be completely impossible. So we use 
> HTTP scripting for testing purposes i.e. send this request, grab the 
> results, verify that the test in the element with id="username" equals 
> "Brian Quinlan", etc. The test also validates that each page is well 
> formed. We also view each page at some point but not every time a 
> developer makes a change that might (i.e. everything) affect the entire 
> system.

Ah, ok, that sounds more sensible. But something as specialised and
complicated as that can surely cope with un-encoding HTML entities?

Incidentally, the company I work for, www.sitemorse.com, does
automated web site testing - and it's all done in Python! :-)



More information about the Python-list mailing list