I was pretty stoked to see this submission from Stian Søiland. We've all seen developers do all sorts of crazy things, from completely avoiding regular expressions to not bothering to use INNER JOINs or even basic WHERE clauses. But this?!? I think takes the cake ... or at least comes pretty close ...

When asked to fix an application here at NTNU that lets students create their own mailinglists, I stumbled over this python script that tries to synchronize database entries with Mailman.

In addition to exploring how to create ugly code with Python, the author has discovered a way to avoid compiling a MySQL driver for Python - by using the "mysql" shell tool and parsing the output by splitting it by whitespace. (This will of course fail if anything resembling a space is present in the database)

Also notice the creation of mysql_cmds.txt for stuff to be executed by the SQL server.

(Debug messages and logging has been removed from the code)

 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!