From 63ca73d6f056aff7ca55a8977dcb68db7a952a43 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 17 Jul 2013 07:37:38 -0500 Subject: [PATCH] fixed issue 1587:Mongodb error on id --- VERSION | 2 +- gluon/dal.py | 3 ++- gluon/utils.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 2d46ead0..7b4aa452 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.07.16.13.14.21 +Version 2.6.0-development+timestamp.2013.07.17.07.36.50 diff --git a/gluon/dal.py b/gluon/dal.py index f72b1036..7a3b03bb 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5540,8 +5540,9 @@ class MongoDBAdapter(NoSQLAdapter): filter = None if query: filter = self.expand(query) + # do not try to update id fields to avoid backend errors modify = {'$set': dict((k.name, self.represent(v, k.type)) for - k, v in fields)} + k, v in fields if (not k.name in ("_id", "id")))} return modify, filter def update(self, tablename, query, fields, safe=None): diff --git a/gluon/utils.py b/gluon/utils.py index 7cb3106d..9f7c3c89 100644 --- a/gluon/utils.py +++ b/gluon/utils.py @@ -80,7 +80,7 @@ def compare(a, b): def md5_hash(text): """ Generate a md5 hash with the given text """ - return md5(text).hexdigest() + return md5.new(text).hexdigest() def simple_hash(text, key='', salt='', digest_alg='md5'):