From d6e63b4d7c29551ae9f428911c606f8c49b42357 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 17 Nov 2013 09:21:16 -0600 Subject: [PATCH] simpled int to hex conversion of mongo id, thanks Alan --- VERSION | 2 +- gluon/dal.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 7ce9068a..fdc8fc8c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.11.16.11.51.18 +Version 2.7.4-stable+timestamp.2013.11.17.09.20.20 diff --git a/gluon/dal.py b/gluon/dal.py index c7a0cca6..69f72e11 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5552,11 +5552,7 @@ class MongoDBAdapter(NoSQLAdapter): if not isinstance(arg, (int, long)): raise TypeError("object_id argument must be of type " + "ObjectId or an objectid representable integer") - if arg == 0: - hexvalue = "".zfill(24) - else: - hexvalue = hex(arg - ).split("x")[-1].replace("L", "").zfill(24) + hexvalue = hex(arg)[2:].rstrip('L').zfill(24) return self.ObjectId(hexvalue) def parse_reference(self, value, field_type):