Python Programming, news on the Voidspace Python Projects and all things techie.
I've had a very pleasant email from the gentleman who added this package to gentoo portage.
It's now updated to the current version.
On the Sillyness of Sourceforge Statistics
For ConfigObj the activity percentile is shown as : (last week): 98.51
Presumably this means that ConfigObj is within the top 2% of active projects - yet if you look at the statistics page you will see that ConfigObj is ranked about position 2000 .
Most projects on sourceforge are dormant (numerically speaking anyway) - these are good ideas that died, or were still born and never produced any (or much) code. This means they skew the 'activity percentile' statistics horribly and that figure is useless. Now if they excluded the dormant projects - it might be an interesting figure......
|||Most of the downloads for ConfigObj (in fact almost all) are direct from Voidspace - which is why the shown quantity is so low.|
Categories: General Programming
I've been playing with CGIHTTPServer.py again. It's basically a toy server - but very handy for local testing. This is especially true because sub-classing it to implement customer behaviour is joyously easy.
Unfortunately I have a problem sigh. Actually I have lots of problems - but this one is specific . Under Python 2.4  the CGI environment variables aren't getting passed to CGI scripts that it runs using os.popen3 (under Windoze).
See the following code (from line 242 in the version shipped with Python 2.3) :
# but they aren't passed to the subprocess
files = popenx(cmdline, 'b')
fi = files
fo = files
fe = files
The truly weird thing is that when I do my own test script calling the same command line - environment variables are passed on. Odd and frustrating. Further investigation needed.
In the process I've also edited CGIHTTPServer to allow two things (although my tests were on the un-fiddled-with version) :
- Paths with spaces in.
- CGI scripts from sub-directories of cgi-bin.
These fixes are specific to the windoze code in CGIHTTPServer. They aren't going to get touched by a Lunix computer which uses fork in another branch of the code.
First, line 234 (again, the Python 2.3 version) changes from :
Secondly, lines 86-90 change from :
i = len(x)
if path[:i] == x and (not path[i:] or path[i] == '/'):
self.cgi_info = path[:i], path[i+1:]
i = len(x)
# FIXME: What if this is -1 ?
j = path.rfind('/')
if path[:i] == x:
self.cgi_info = path[:j], path[j+1:]
I wonder if there is an issue with 'PATH_INFO' and this second 'fix' ?.... hmmm...
Anyway - simple stuff, but it's helped me.
|||A development folder and a backup folder with the rest of the site that I'm not editing. Very useful - I can edit a few files from one folder 'live', whilst serving the rest of the site from the backup folder.|
|||Probably only useful for me. It drops all requests other than ones to localhost. Our home LAN isn't on the internet - so fetches to external domains take annoying seconds to timeout. In proxy mode they are simply forgotten...|
|||And not Python 2.3|
Rolling, Rolling, Rolling
The response to pythonutils was very good. Especially the odict module (ordered dictionary) - it's had over one hundred and fifty downloads already. Thanks to some useful user feedback, Nicola has updated and improved it.
More embarassingly I've done a bugfix release of ConfigObj - now up to beta 5.
All this is my way of saying that odict 0.1.2, pythonutils 0.2.2, and ConfigObj beta 5, are all available from the Voidspace Modules page.
Login and On
One of my 'projects' that has languished a bit is logintools.
I was again struck by how easy protecting a CGI application with logintools is . It was just a case of adding add a few lines to the start of the application - and authentication/account management is fully handled :
userdir = 'users/'
def main(theform, userdir):
# this function displays login and exits if it fails, otherwise it prints
# the new/updated cookie.
action, userconfig = login(theform, userdir)
username = userconfig['realname']
loginname = userconfig['username']
# rest of application from here
if __name__ == '__main__':
theform = cgi.FieldStorage()
The CRM probably won't be open source  - but logintools should get some work at last.
|||Since I moved server the demo has stopped working. The code is also fairly horrible. I will fix the demo - but I don't know if I have the time to refactor Jalopy unless I can use it for my current project.|
|||I haven't yet released this - but if anyone wants it they can contact me on firstname.lastname@example.org.|
|||Or at least probably not very useful to anyone else....|
I've been porting all my apps and tools to use the new version of ConfigObj. In the process I've uncovered two more moderately serious bugs.
We weren't unquoting keys and a comma in an inline comment could be wrongly recognised as a list (a failing in the regular expression we used).
This means I'll be doing a ConfigObj Beta 5 release, along with a Pythonutils 0.2.2 very soon. sigh
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.