autotest/virt-test — pull request #557 by jzupka (2013-06-20 11:14:26+00:00)
Title: Adds new version of Versionable class and solve comatibility problems with old version.

Compare old and new version of verisonable class.
pros) multiple version of class in one process
change version of class by parameters passed by class factory.
support of pickling.
cons) It is necessary use factory and line with registration of module.
For access to specific class version is necessary to use class
manager.

usage:

from versionable_class import Manager, factory, VersionableClass
#register module to class manager. Necessary for pickling.
man = Manager(__name__)

class VM1(object):
@classmethod
def _is_right_ver(cls, version):
return True

def __init__(self, *args, **kargs):
super(VM1, self).__init__(*args, **kargs)

def fn1(self):
print "fn1_VM1"

class VM_container(test_vers.VersionableClass):
__master__ = VM1

o = test_vers.factory(VM_container) # return class
o = o() # create instance of class
o.fn1()

Already used by openvswitch.