Python web development, really
Max M
maxm at mxm.dk
Mon Jan 20 15:50:43 EST 2003
Afanasiy wrote:
> * Run on the same hardware I use currently
>
> * Be as fast or faster than Apache+PHP
> (I'm sorry to say Zope/Roxen are not)
> (This might mean it must use Apache)
>
> * Use a similar amount of memory
> (ie. not Java/.NET related)
So you want the advantages of Python, but none of the trade-off's. Well
wouldn't we all?
You would have to write test for your app to test this. But they should
be roughly in the same ballpark.
>
> * Provide a fairly equivalent framework w/ sessions, cookies, get, post
> (Described in http://www.boddie.org.uk/python/web_frameworks.html)
> (eg. I should not have to write code to parse query strings, etc.)
> (PHP is somewhat unique in the ways it can bring in post variables)
I don't know about sessions, but my guess is that there is something out
there. cookies, get and post's can be handled nicely by the cgi module.
> * Allow all errors to be caught and handled so users never see them
> (I currently send them to an email address)
> (Users are notified an error occurred and a developer contacted)
try/except works like a charm for this. Use it myself.
> * Allow sending of email
smtplib is your friend. Not quite as friendly as some email packages.
But together with the email module it is very powerfull
> * Allow sending of raw binary data, for restricted file downloading
> (eg. http://example.com/sendfile.php?id=A6DE12FAB3...etc)
> (This requires header manipulation, specifically the mime type)
> (That sort of thing should be part of the framework 3 bullets up)
It is not quite clear what you mean here. But if you want to send a file
from your server to another webserver/form, you just use urllib/urllib2.
If you want to receive files on your server it is built into the cgi module.
> * Allow SSL secured authorize.net credit card processing
> (I currently use PHP's libcurl+ssl module)
Doesn't Apache do this?
> * Allow similarly powerful regex capabilities
> (I currently use PHP's pcre module)
Pythons regexp's are probably as powerfull as any. Se the re module.
> * Big plus, but optional, auto prepend/append files
> (eg. Apache+PHP has .htaccess directives like this )
> ( php_value auto_prepend_file "_header.php" )
> ( php_value auto_append_file "_footer.php" )
> (granular down to the directory
hmmm! Don't know about this one. Python isn't embedded like that out of
the box. Should be pretty easy to write a function wich does something
like it though.
> * Finally, very optional plus, global application scoped variables
> (PHP does NOT allow this, but I know why)
> (I do not want to hear why you think this is bad)
> (I know why it is good, I know why it can be bad)
Use the Borg pattern:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
regards Max M
--
hilsen/regards Max M
http://www.futureport.dk/
Fremtiden, videnskab, skeptiscisme og transhumanisme
More information about the Python-list
mailing list