wlanslovenija / PiplMesh

A social info portal for wireless networks.
http://dev.wlan-si.net/wiki/PiplMesh
Other
40 stars 19 forks source link

Errors are occasionally thrown when connections contain None value #325

Open mitar opened 11 years ago

mitar commented 11 years ago

In our code for checking online users, we remove values from connections in two steps: first we set all stale data to None and then we remove all None values. It seems this has a problem that if user object is accessed just in between this two steps, MongoEngine throws an error: connections - 'NoneType' object has no attribute 'get. Connections object is something like this:

 u'connections': [None,
                  {u'channel_id': u'user/8624cec1-8010-4cfc-9b42-c3a297f5bfed',
                   u'http_if_modified_since': u'Thu, 1 Jan 1970 00:00:00 GMT',
                   u'http_if_none_match': u'0'},
                  {u'channel_id': u'home',
                   u'http_if_modified_since': u'Thu, 1 Jan 1970 00:00:00 GMT',
                   u'http_if_none_match': u'0'}],

It fails at line 979, mongoengine/mongoengine/base.py in _from_son.