Wiki

Clone wiki

pymoult / dupdate

#Updating the data

The lowlevel.data_update module provides tools for updating the data.

  • updateToClass(obj,oldclass,class,transformer) updates obj to class class (privided it is of type oldclass) and applies transformer to it. transformer is a function taking an object as argument. If oldclass is none, obj will be updated to class.

  • generateMixinUser(class,*mixins) creates a new class from class by adding the mixins to it.

  • applyMixinToObject(obj,*mixins) creates a new class from the class of obj by adding the mixins to it. Then, obj is updated to that new class.

  • addFieldToClass(class,name,field) adds field to class under the given name. That field can be any attribute in the sens of Python (e.g. a class attribute, a method ...). This function can be used to modfy an existing field of a class.

  • addMethodToClass(class,name,method) behave exactly as addFieldToClass.

  • redefineClass(module,tclass,nclass) redefines tclass from module to its new version nclass.

Updated