I've started to fix mongodb-engine to get it working with recent versions of toolbox. After blindly fixing the compiler, I've decided to have a look at the pre-existing test cases.
Quite a few of them were failing due to the fact that the returned obj.pk is a unicode string, instead of an ObjectID. As a result, I could make many failing tests pass by the following assertions:
def assertEqualModels(self, model1, model2, message=None):
self.assertEqual(model1.pk, ObjectId(model2.pk), message)
def assertEqualModelsList(self, model1, model2, message=None):
model1_pks = map(attrgetter('pk'), model1)
model2_pks = map(ObjectId, map(attrgetter('pk'), model2))
Is there any reason to prefer ObjectID or plain strings above the other? The test in lookup.py:115 fails, because it returns ObjectID keys in the resulting dictionary.
It might be easier to stick with ObjectID instead of unicode ids. What do you think? Is there any prior knowledge on this topic?
lookup.py? Where did you find that file?
btw, all three branches (1.3, 1.4, 1.5) of MongoDB Engine should work with the matching djangotoolbox versions.
sorry, it was the lookup module under the tests package
my version is here, it was forked today from master, and run against a virtualenv containing the master of djangotoolbox
err, I've checked djangotoolbox versions again, but could not find any
I would be glad if you could help me in finding the matching branches though
these are my guesses:
Am I right with the above table? What branch should I use for django-nonrel 1.3?
As I've heard that the 1.3 branches are the most stable, I would prefer to have that installed first, and would try to fix the 1.4 branch - if necessary - afterwards.
Follow these instructions for 1.3 http://django-mongodb.org/topics/setup.html
Or, if you want to have the latest 1.3.X minor release, go with master/master/master for django/toolbox/mongodb-engine.