From bdc214f45b248bd26d2fd0d890373b79a1647e57 Mon Sep 17 00:00:00 2001 From: Alan Etkin Date: Sat, 16 Nov 2013 17:16:59 -0300 Subject: [PATCH] MongoDB: fixed object_id function (hex values) --- gluon/dal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gluon/dal.py b/gluon/dal.py index ea583da7..c7a0cca6 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5555,7 +5555,8 @@ class MongoDBAdapter(NoSQLAdapter): if arg == 0: hexvalue = "".zfill(24) else: - hexvalue = hex(arg)[2:].replace("L", "") + hexvalue = hex(arg + ).split("x")[-1].replace("L", "").zfill(24) return self.ObjectId(hexvalue) def parse_reference(self, value, field_type):