Wow, the BDFL! :O
You're right, it's not all the relevant code. After some more research, it appears to be a problem with using the blobstore in an ndb.transactional decorator. I don't know if it is relevant to the db module as well. This issue was brought to my attention:
http://code.google.com/p/googleappengine/issues/detail?id=8354. It strikes me as likely to be the same problem.
I've since taken my blobstore code out of the transaction (as it probably should have been to begin with), so this issue no longer applies to me. I suspect that wrapping the code I gave in a transaction will cause the same error. Unfortunately, I pruned my buggy transactional branch and don't have the code snippet to post for you.
Thanks for responding!