hmarr/mongoengine — pull request #531 by agonzalezro (2012-07-02 08:08:38+00:00)
Title: Force a cast from tuple to list on meta['indexes'] & initialize direction variable

I'm using mongoengine with pip and I get this error since I upgrade mongoengine (from a very old version forked by metzlar):

```
Traceback (most recent call last):
File "/opt/pypy-1.7/lib-python/2.7/unittest/case.py", line 318, in run
testMethod()
File "/var/lib/jenkins/jobs/Eelogic/workspace/.env/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
File "/var/lib/jenkins/jobs/Eelogic/workspace/.env/site-packages/nose-1.1.2-py2.7.egg/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/var/lib/jenkins/jobs/Eelogic/workspace/.env/site-packages/nose-1.1.2-py2.7.egg/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/var/lib/jenkins/jobs/Eelogic/workspace/eelogic/auth/__init__.py", line 6, in
from eelogic.auth import views
File "/var/lib/jenkins/jobs/Eelogic/workspace/eelogic/auth/views.py", line 16, in
from eelogic.social.id5client import ID5Client
File "/var/lib/jenkins/jobs/Eelogic/workspace/eelogic/social/__init__.py", line 9, in
from eelogic.social import views
File "/var/lib/jenkins/jobs/Eelogic/workspace/eelogic/social/views.py", line 11, in
from eelogic.social.models import CheckIn, SocialQuery
File "/var/lib/jenkins/jobs/Eelogic/workspace/eelogic/social/models.py", line 7, in
class CheckIn(db.Document):
File "/var/lib/jenkins/jobs/Eelogic/workspace/.env/site-packages/mongoengine-0.6.13-py2.7.egg/mongoengine/base.py", line 707, in __new__
indicies = meta['indexes'] + abstract_base_indexes
TypeError: unsupported operand type(s) for +: 'tuple' and 'list'
```

To fix it I casted meta['indexes'] to list.

I don't know if it's the best way to do it or perhaps a check like:

```python
if type(meta['indexes'] == tuple):
meta['indexes'] = list(meta['indexes'])
```

But I don't see the point of this check.

Furthermore, running the tests (of mongoengine) there is a variable called `direction` that is not initialized. I initialized it to None, but I get 4 more failures.