def to_dict(self):
<EOL>data = self.extract_fields()<EOL>for key, attr in self.attributes.iteritems():<EOL><INDENT>if key in self.ignore:<EOL><INDENT>continue  <EOL><DEDENT>value = getattr(self.context, attr, None)<EOL>if value is None:<EOL><INDENT>value = getattr(self, attr, None)<EOL><DEDENT>if callable(value):<EOL><INDENT>value = value()<EOL><DEDENT>data[key] = api.to_json_value(self.context, key, value)<EOL><DEDENT>return data<EOL>
extract the data of the content and return it as a dictionary