basho/riak-python-client — Issue #86: Enable user's to use their own RiakObject subclass
Author: HonzaKral
Created: 2011-10-31 20:45:42+00:00
State: open

I propose a bacwards-compatible change to the API that would enable people to supply their own RiakObject subclass to be returned from Riak. Example would be:

```python
class Director(Person):
...

class Movie(RiakObject):
def get_director(self):
for l in self.get_links():
if l.get_tag() == 'directed_by':
return l.get(result_class=Director)
return None

pf = riak_client.bucket('imdb').get('pulp_fiction', result_class=Movie)
pf.get_director()
```

I will be happy to provide the patch if you are interested.