Replaced slow exception handling with has_key.

This commit is contained in:
Florian Schlachter 2010-08-30 14:58:58 +02:00
parent 95efa39b52
commit e0911a5fe0

View File

@ -415,11 +415,8 @@ class BaseDocument(object):
self._meta.get('allow_inheritance', True) == False):
data['_cls'] = self._class_name
data['_types'] = self._superclasses.keys() + [self._class_name]
try:
if not data['_id']:
del data['_id']
except KeyError:
pass
if data.has_key('_id') and not data['_id']:
del data['_id']
return data
@classmethod