Extracting e-mails from a vCard file with Python

Date Arrow  April 23, 2008

Let’s say that you have a vCard file. You can export it from your Mac OS X AddressBook.app, or from any other similar application. Now you need to extract some information from it, namely the e-mails, for spamming your friends with some boring news. Typical.
Enter vobject. This Python library is part of the Chandler effort [...]

Tagged   How to?Comments  Add Your Comment (2)

Quick spec from your Python tests

Date Arrow  April 17, 2008

Using Python’s own unittest package, here’s a small script that can iterate over your test suite to output a small, quick, nice list of the tests in your application:

import unittest

loader = unittest.TestLoader()
tests = loader.loadTestsFromName(’path.to.your.tests.package’)
for test in tests._tests:
print test._tests[0].__class__.__name__.replace(”Test”, “”)
for method in test._tests:
[...]

Tagged   Django · How to? · QualityComments  Add Your Comment (2)

Django Architecture Approaches

Date Arrow  April 4, 2008

I’ve just had a very interesting conversation with my colleague Marco about different approaches to the organization of code inside a Django application.
As you might know (and if you don’t I’ll tell you anyway), Django’s views (somehow occupying the “Controller” level in an MVC architecture) must take (at least) an HttpRequest instance as a parameter and must [...]

Tagged   Architecture · Django · Open SourceComments  Add Your Comment (11)

Playing with HTTP libraries

Date Arrow  March 26, 2008

It’s fun to find out how to tackle the same task in different programming languages; in this case, it’s all about doing HTTP requests over a network: fortunately, there are networking libraries in virtually all major programming languages. In my current project, I’m generating wrappers easing the access to the core of the project itself, [...]

Tagged   Code · How to?Comments  Add Your Comment (5)