-
posts
-
Cron only decorator for appengine
For a recent project I recently I have been using appengine’s cron
feature to aggregate data and perform maintenance tasks. However, since
cron is a simple web request, if a user accesses that url then the cron
job will run. In order to prevent no...
-
Dynamically Adding a Method to Classes or Class Instances in Python
In Python you sometimes want to dynamically add methods to classes or
class instances (objects). In Python code, the most obvious way to
accomplish this might be something like the following but it has one
caveat,
class MyObj(object):
def __i...
-
Key Value Storage Systems ... and Beyond ... with Python
Google docs wouldn't let me share the presentation publicly with people outside our company's domain and it gave me an error when I tried to download it as a Powerpoint file or PDF so I was forced to recreate my presentation locally. Anyway, I pla...
-
python-openvcdiff and Cython
I started a project today to implement an interface for the
open-vcdiff using
Cython. I’m not a C++ master and the Python C
libraries are pretty new to me but I managed to expose and implement a
few methods of the VCDiffEncoder class. The hardest ...
-
Parsing email with attachments in python
Recently I needed to be able to parse out attachments and body from
multipart emails and use the resulting data to post to a service. So I
wrote the code below to parse out text and html portions of the email
and also parse out attachments.
The c...
-
Transactions on Appengine
The way to store data on Appengine is with
Google’s
BigTable Datastore
which has support for transactions. However, the transactions are quite limited
in that,
You can only execute callables inside transactions. Which means you
basically ...
-
Werkzeug and reverse urls
I wanted to impove a Google Appengine application that a friend of mine created (ほぼ汎用イベント管理ツール(jp)) and noticed that he was redirecting directly to urls. He is using Werkzeug to handle url routing so I wondered if there was a method for generating...
-
QueryDict and update()
Yesterday I ran into an interesting quirk with Django's QueryDict object and the normal dictionary update() method. Normally the update method will allow you to merge two dictionary or dictionary like objects but because the QueryDict internally h...
-
Field/column Queries in Django
One of the neat things making it's way into Django 1.1 is F object queries. The F object is kind of like the Q object as it can be used it queries but it represents a database field on the right hand side of an equality/inequality.
For the exampl...
-
Python date range iterator
I couldn’t find something that gave me quite what I wanted so I created
a simple Python generator to give me the dates
between two datetimes.
def datetimeIterator(from_date, to_date):
from datetime import timedelta
if from_date > to_da...