Skip to content

Commit

Permalink
For now we should use FloatType instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
wsantos committed Aug 17, 2014
1 parent 6edbeba commit e5fb8ad
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions motorm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/env python
from schematics.models import Model, ModelMeta
from schematics.contrib.mongo import ObjectIdType
from pymongo.son_manipulator import SONManipulator
from decimal import Decimal

#-- Tornado
from tornado.concurrent import return_future
Expand All @@ -19,25 +17,6 @@
_mc = None
BATCH = 5

#FROM: https://gist.github.com/reedobrien/745735
class DecimalTransform(SONManipulator):
def transform_incoming(self, son, collection):
for (key, value) in son.items():
if isinstance(value, Decimal):
son[key] = {'_type' : 'decimal', 'value' : unicode(value)}
elif isinstance(value, dict):
son[key] = self.transform_incoming(value, collection)
return son

def transform_outgoing(self, son, collection):
for (key, value) in son.items():
if isinstance(value, dict):
if "_type" in value and value["_type"] == "decimal":
son[key] = Decimal(value['value'])
else:
son[key] = self.transform_outgoing(value, collection)
return son

def connect(db, io_loop=None):
global _db
global _mc
Expand Down

0 comments on commit e5fb8ad

Please sign in to comment.