equal
deleted
inserted
replaced
56 field_names: the fields that should be included, defaults to |
56 field_names: the fields that should be included, defaults to |
57 all fields that are of a type that is in DICT_TYPES. |
57 all fields that are of a type that is in DICT_TYPES. |
58 """ |
58 """ |
59 |
59 |
60 result = {} |
60 result = {} |
61 props = self.properties() |
|
62 |
61 |
63 if not field_names: |
62 if not field_names: |
|
63 props = self.properties() |
64 field_names = [k for k, v in props.iteritems() if isinstance(v, self.DICT_TYPES)] |
64 field_names = [k for k, v in props.iteritems() if isinstance(v, self.DICT_TYPES)] |
65 |
65 |
66 for key, value in props.iteritems(): |
66 for key in field_names: |
67 # Skip everything that is not valid |
67 # Skip everything that is not valid |
68 if key not in field_names: |
68 if not hasattr(self, key): |
69 continue |
69 continue |
70 |
70 |
71 result[key] = getattr(self, key) |
71 result[key] = getattr(self, key) |
72 |
72 |
73 if hasattr(self, 'name'): |
73 if hasattr(self, 'name'): |