net-0.1 (Attached)

I hate to toot my own horn, but if you do anything with CGI and Python then chances are you’ll find this pretty interesting and or hopefully useful .

Some History:

A little while ago I had an idea for a project kind of a Zope-WikiWiki-CGI half bread named Nickel. However I was reluctant to start on the project using Pythons current CGI modules (I don’t think I’m the only one who things Python is lagging behind the times in this respect), in particular ‘Cookies’; as it seemed to me that that the module itself has been mostly depreciated and in need of a serious update.

So I sat down whipped up my own module to handle common CGI tasks the way I wanted them handled

2.Automatic form variables (net.form[‘key’]). Although this seems very stable it does need heavy testing. With the possibility of more features being added to the form parser.

3.Simple, automatic error catching. This is just a formatted HTML version of Pythons standard error messages.

4.Last but not least the module comes ready packaged to take advantage of Python 2.3’s ZIP import feature. All you have to do is move net.zip to you're site-packages directory and point a pth file at it!

If you want to find out more about pth files check out the link below:

It looks pretty good to me mate, though it doesn't seem to provide a great deal of extra functionality over the current cgi module. maybe add a logging feature like there is in cgi.py, then start working on some nifty little features to show the current cgi module up

Ah the idea wasn't to fill the module with lots of useless stuff like multiple field storage classes .

Although i plan to make the functions in module.py available in though 'net' for version 0.2 aswell as having cookies variables automatically loaded like forms.

I'm trying to keep it as simple as i can, but make it more of an environment than a module... it actually does the job of cgi, Cookie and cgitb but much more elagantly! All you have to do is import the module and most common tasks are done for you...

I was also considering a URL data type for manipulating URLs and or reading from a website. The log sounds cool though. i just don't like the idea of somone being able to load the error log though there browser. Seems like a bit of a security hole.

Plus, in order to be of much use it would have to have all the power of Apache's error log.

Cool stuff netytan . One question though: Is there any way to submit things like this, along with language extentions to the Python team for review or something? That way if a developer wrote something that had potential, it could have the chance to be included in the language or distribution.

Thanks , i did go a little comment nuts i admit but. Not as far as i know Xx:

I think if everyone is using the module or there is demand for the it in python then the Python team include it although not having anything in the standard lib myself i don't know the finer points... but it seems to be a populrity contenst .

Having said that there are alot excelent 3rd party things that havn't yet made it in!

So i surpose if you really wished to show of you're work you could always post it on the mailing list or email the Python guys directly at webmaster@python.org and see what comes back.

Another good way to get you're code around would be to add it to the PyPI like Grim did with his excelent py2html module.

netytan - I realise you're trying to make things cleaner rather than bloat the module, and that's cool. however, all the functionality your module provides is already achieveable with existing modules, so using it is purely for cosmetic reasons. I hope you don't take offense or anything, I like the idea and the implementation so far, I don't mean to come off as an ***

To get it considered as a module to ship with the standard Python distro, you would probably need to suggest it in a PEP on the Python site and see what kind of support / criticism you get. If the idea is supported, you could get it added to the list of todo's. However, as the module doesn't provide any extra functionality and would be put into to use for "cleaning" purposes, it would probably be low on the list if supported.

Your best bet would be to look into getting it on the "Sumo" distro of Python. I'm not sure on the status of this project, but it's basically a distro of Python with a whole heap of extra bells and whistles (in the form of third party modules etc). Worth looking into anyway

No problem rebbit, critasism is as good as praise . Actually net suports loading cookies - a feature i am not aware of in the std-lib. And in version 0.2 a new encode, decode (URL encryption and decyption) and escape (an omproved version of cgi.escape; the only remotly useful function in there IMO) function are availble.

I'm also thinking about replacing the 'form' variable with 'request' or 'namespace' like in PHP which will contain values from all input streams (currently - cookies and forms) instead of having seperate var names. I will also be adding a config file to give more controle over nets options.

Ah. i dont wana get it in the std-lib. Or at least not yet , it has a long way to go before i'll be happy with it. But it usable, and whats morevery clean, and i'm a big fan of clean code .