Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Look at object parents when mapping to column families

Using self.cls.__dict__ only looks at the members of the class and
not any parents.  Better to use inspect.getmembers() for this
purpose and get the full hierarchy
  • Loading branch information...
commit 335995e70dbea769f8174bd92fde38abff05031b 1 parent 79bb07d
Jeremy Katz authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  pycassa/columnfamilymap.py
3  pycassa/columnfamilymap.py
@@ -14,6 +14,7 @@
14 14 from pycassa.types import CassandraType
15 15 from pycassa.columnfamily import ColumnFamily
16 16 import pycassa.util as util
  17 +import inspect
17 18
18 19 __all__ = ['ColumnFamilyMap']
19 20
@@ -51,7 +52,7 @@ def __init__(self, cls, pool, column_family, raw_columns=False, **kwargs):
51 52 self.dict_class = util.OrderedDict
52 53 self.defaults = {}
53 54 self.fields = []
54   - for name, val_type in self.cls.__dict__.iteritems():
  55 + for name, val_type in inspect.getmembers(self.cls):
55 56 if name != 'key' and isinstance(val_type, CassandraType):
56 57 self.fields.append(name)
57 58 self.column_validators[name] = val_type

0 comments on commit 335995e

Please sign in to comment.
Something went wrong with that request. Please try again.