liberation/redis-limpyd — pull request #37 by twidi (2012-08-06 12:39:15+00:00)
Title: Enhance the field copy system.

Many times, RedisField objects are copied, using the copy module.
The way the __copy__ method did things was to create a new object,
and copy other attributes.
In a subclass, to copy new attributes, it was as easy as to define a new
__copy__ method, call super, and do more stuff.
But there was a big problem with the call to the constructor: we passed
the whole self.__dict__ dict, whatever the real signature was. First, we
pass some not attended arguments, and second, this didn't work if the
signature is different.
So all the __copy__ method is now rewritten to call the constructor, and
copy attributes, all using a _copy_conf attribute on the class.
This _copy_conf attribute is a dict with 3 entries:
- args: list of attributes names to pass as *args to the constructor
- kwargs: list of attributes names to pass as **kwargs to the
constructor. If a tuple is used instead of a simple string
in the list, its first entry will be the kwarg name, and
the second the name of the attribute to copy
- attrs: list of attributes names to copy (with "=") from the old
object to the new one

The main goal of this internal change, is to allow subfield with different
signatures than RedisField