hmarr/mongoengine — Issue #377: Dynamic field not checking for parts List length
Author: Amorano
Created: 2011-12-02 02:25:28+00:00
State: open

mongoengine\base.py

line 983:
if self._dynamic and parts[0] in self._dynamic_fields:

changed to:

if self._dynamic and len(parts) and parts[0] in self._dynamic_fields:

Looks like the assumption is made that parts will always have an element.

I have found that is not always the case.

Checking for length first has seemed to patch this.