make mongoengine more international :) using unicode-strings; str(err) raises errors if it contains non-ascii chars/umlauts

This commit is contained in:
Florian Schlachter 2010-02-02 21:48:47 +01:00
parent 69e9b5d55e
commit 59f8c9f38e

View File

@ -520,9 +520,9 @@ class QuerySet(object):
self._collection.update(self._query, update, safe=safe_update, self._collection.update(self._query, update, safe=safe_update,
multi=True) multi=True)
except pymongo.errors.OperationFailure, err: except pymongo.errors.OperationFailure, err:
if str(err) == 'multi not coded yet': if err.message == u'multi not coded yet':
raise OperationError('update() method requires MongoDB 1.1.3+') raise OperationError(u'update() method requires MongoDB 1.1.3+')
raise OperationError('Update failed (%s)' % str(err)) raise OperationError(u'Update failed (%s)' % err.message)
def update_one(self, safe_update=True, **update): def update_one(self, safe_update=True, **update):
"""Perform an atomic update on first field matched by the query. """Perform an atomic update on first field matched by the query.