This is my little garden of simple single-file Python modules for solving annoying problems. Feel free to use them in any way you see fit, I consider them to be in the public domain.
imagedetect.py, simple module for detecting image types (GIF, TIFF, PNG and JPEG) from the first few bytes of the file. Ideal for detecting the type before you save the image in a web upload.
modtimeurls.py, a Django middleware which inspects rendered HTML and modifies links to local files to include a timestamp in a non-intrusive fashion to bust client caches upon changes to the files. This also enables easy near-perfect caching of static files.
bulkops.py which provides an
insert_many and an
that inserts/updates a list of Django objects with one SQL
query. This can significantly speed up insertion of a big
list of objects.
Back to home.