Python: Transform a dictionary into class attributes

Given a python class, suppose that you want to transform a dictionary into class attributes. This is easier than it may seem. Just add a function to the class that takes a dictionary and sets an attribute for each key-value pair in the dictionary. After calling this method, instances of the class will have class attributes mapped to the keys of the…

Read More

Python CouchDB Rocks!

I've been playing around with couchdb using python-couchdb on ubuntu 7.10. It's in debian sid unstable so it can be installed trivially with apt-get or synaptic. You can also install it the old-fashioned way by following these instructions.Couchdb is explained here. I was searching for a system that was close enough to the VIA repository that we us…

Read More

Python: flask security via mongo engine

Flask-Security is a flask extension that provides confirmation, registration, recovery, and tracking. Flask-Security supports SQLAlchemy, PeeWee, and MongoEngine. However, finding a complete MongoEngine example using all the Flask-Security features has been difficult. So here it is: import datetime from flask import Flask, render_template from flas…

Read More

Proxmox Virtual Environment (PVE): Your Own Private Cloud

You've probably heard of terms such as KVM and OpenVZ, but until now, large data center virtualization operations were beyond the reach of most individuals or small organizations. In addition, many individuals and organizations face challenges with data privacy relating to having personal or customer data in a public cloud. A relatively simple and …

Read More

Tests happen: tests that write themselves

Wikipedia defines the mythical man-beast known as metaprogramming thusly: Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. Everyone has heard about it, but few understand it. What makes i…

Read More