I was deeply sad to hear of the untimely death of John Pinner. I met John at PyCon UK a few years ago, and very quickly learnt a great respect for him as a man, a friend, a mentor. I saw him but once a year at the annual PyCon UK conference, and yet he had a great effect on me; I can only imagine the huge void that will be left by his passing for those who knew him more closely.
For example, ‘15,99 EUR’ See whether you have the right locale installed. $ locale -a If not $ sudo apt-get install language-pack-es $ sudo dpkg-reconfigure locales And then in the code, you can do this import locale myprice = unicode(locale.atof(myprice))
I like BDD. I like cucumber. I like python. I like django. I don’t like lettuce, a commonly-used python port of cucumber, when used with django. They’ve chosen the completely daft option to use your main database when testing. I’d forgotten this, so when I discovered I’d torched my production database just because I wanted to write a test, I decided to not touch lettuce again… And then I discovered behave, which works fine as a python BDD tool; except it doesn’t have an easy tie-up with django.
http://www.ibm.com/developerworks/xml/library/x-hiperfparse This is a really useful article about “High-performance XML parsing in Python with lxml”. But there’s one gotcha I’ve discovered with the fast_iter() method described therein. Can’t comment on that website without getting yet another developer ID, so I’ll describe the issue here and hope that Google picks it up. The problem comes with nested tags with the same name. For example: <product> <data> <product>Some useful data</product> </data> </product>
To import a module where you have the module name as a string and want to do it programmatically: X = import(‘X’) X is now a variable that can be used in your code: e.g. getattr(X, method)
The obvious cause of this is that the settings.py doesn’t have the directory containing blah listed in INSTALLED_APPS. A less obvious cause: you’ll also get this error if the directory doesn’t contain a file init.py.
To help me get to grips with Django quickly, I created a search engine of the documentation. On the off-chance this is useful to others, I made it available at http://www.hobthross.com/docs/django/phpdig/search.php (Sorry if this does not show up as a hyperlink, WordPress appears to be chewing that up and ignoring it)
I’ve just taken a look at Django for the first time, and am seriously impressed. For a while now, I’ve been trying to find a way of using Python in websites, and haven’t found anything that works well enough - Zope, Cheetah, mod_python - all seem very difficult to get the simplest thing working… But Django looks like the answer. The guys behind Django have produced a very useful tutorial to help you get going with it, and the users mailing list seems very responsive…