Replaced slow exception handling with has_key.
This commit is contained in:
parent
95efa39b52
commit
e0911a5fe0
@ -415,11 +415,8 @@ class BaseDocument(object):
|
|||||||
self._meta.get('allow_inheritance', True) == False):
|
self._meta.get('allow_inheritance', True) == False):
|
||||||
data['_cls'] = self._class_name
|
data['_cls'] = self._class_name
|
||||||
data['_types'] = self._superclasses.keys() + [self._class_name]
|
data['_types'] = self._superclasses.keys() + [self._class_name]
|
||||||
try:
|
if data.has_key('_id') and not data['_id']:
|
||||||
if not data['_id']:
|
|
||||||
del data['_id']
|
del data['_id']
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user