Welcome to my site! I'm a web developer in Lawrence, KS, and I like blogging about Python and programming in general. Below you can check out what I've been up to lately.


Writing

  • Working around Django's ORM to do interesting things with GFKs May 03, 2012 00:05

    In this post I want to discuss how to work around some of the shortcomings of djangos ORM when dealing with Generic Foreign Keys (GFKs).

    At the end of the post I'll show how to work around django's lack of correctly CAST-ing when the generic foreign key is of a different column type than the objects it may point to.

  • Micawber, a python library for extracting rich content from URLs April 19, 2012 11:13

    A while ago I wrote about an awesome API for retrieving metadata about URLs called oembed. I'm writing to announce a new project I've been working on called micawber, which is very similar but with a cleaner API and not restricted to django projects.

  • Using Redis Pub/Sub and IRC for Error Logging with Python April 15, 2012 11:23

    I recently rewrote my personal site using flask and peewee, breaking a good amount of stuff in the process. I was trying to track down the errors by tailing log files, but that didn't help alert me to new errors that someone visiting the site might stir up. I thought about setting up error emails a-la django, which is a tried and true method...but then I happened on a different approach. I won't say it's the most elegant solution, but it was a quick hack and the results have been awesome. I wrote a custom logging handler that pushes JSON-encoded log record data to a redis pub/sub channel. I then have an IRC bot that subscribes to this channel and when it receives a message generates a paste of the traceback and pings me with a link to the traceback.

  • More posts...

Coding

  • 840bf5 to peewee Charles Leifer on May 15, 2012 11:32

    Moving pwiz into extras

  • c9e8b3 to peewee Charles Leifer on May 15, 2012 11:21

    Adding extra goodies, like signals

  • d65830 to peewee Charles Leifer on May 15, 2012 09:22

    Fixing whitespace, adding a pre-commit hook hoping this won't be an issue going forward

  • 840b60 to peewee Charles Leifer on May 14, 2012 12:56

    Adding a prepared() hook on the model instance, which will be called when a row is pulled from the db cursor and the model has had its fields populated from the row. Fixes #82

  • 572d47 to peewee Charles Leifer on May 14, 2012 09:37

    Updating docs on using 'formats' parameter with date/time fields

  • 0d9708 to peewee Charles Leifer on May 14, 2012 09:29

    Adding more robust support for various datetime formats, fixes #68

  • 484a43 to peewee Charles Leifer on May 11, 2012 14:08

    Cleaning up some docs that had gotten crufty and adding better links between

  • 8b1a18 to peewee Charles Leifer on May 11, 2012 13:45

    Linking db stuff to cookbook stuff

  • a3b3de to peewee Charles Leifer on May 11, 2012 13:38

    Adding notes on transaction() to the database api reference

  • 061e65 to project-euler Charles Leifer on May 11, 2012 11:28

    Solved problem75