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.
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.
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.
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.
Moving pwiz into extras
Adding extra goodies, like signals
Fixing whitespace, adding a pre-commit hook hoping this won't be an issue going forward
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
Updating docs on using 'formats' parameter with date/time fields
Adding more robust support for various datetime formats, fixes #68
Cleaning up some docs that had gotten crufty and adding better links between
Linking db stuff to cookbook stuff
Adding notes on transaction() to the database api reference
Solved problem75