Commits

Roman Tolkachyov committed 83fa95e

Hot fix

Comments (0)

Files changed (1)

easycouch/couch.py

 		elif isinstance(value, dict) and value.has_key('_id'):
 			print "make lazy", value
 			value = LazyDocument(self.couch, value['_id'])
-			print "get lazy", value()
 		elif isinstance(value, dict):
 			for key in value:
 				value[key] = self.struct_to_obj(value[key])
 	
 	def to_json(self, obj):
 		obj_data = obj._get_state_diff()
+		resoult = {}
 		for name, prop in self.properties.items():
 			if obj_data.has_key(name):
-				obj_data[name] = prop.to_db(obj_data[name])
+				resoult[name] = prop.to_db(obj_data[name])
 			elif hasattr(obj, name):
-				obj_data[name] = prop.to_db(getattr(obj, name))
+				resoult[name] = prop.to_db(getattr(obj, name))
 			else:
-				obj_data[name] = prop.to_db(prop.get_default())
+				resoult[name] = prop.to_db(prop.get_default())
 		for key,value in obj_data.items():
 			if not self.has_property(key):
-				obj_data[key] = self.struct_to_json(value)
-		return obj_data
+				resoult[key] = self.struct_to_json(value)
+		return resoult
 	
 	def add_property(self, name, prop):
 		self.properties[name] = prop