Merge branch 'master' into 0.8

Conflicts:
	.travis.yml
	AUTHORS
	docs/changelog.rst
	mongoengine/base.py
	mongoengine/queryset.py
	tests/queryset/queryset.py
This commit is contained in:
Ross Lawley 2013-04-12 13:36:29 +00:00
commit 04b85ddbf2
8 changed files with 45 additions and 16 deletions

View File

@ -2,21 +2,17 @@
language: python
services: mongodb
python:
- "2.5"
- "2.6"
- "2.7"
- "3.2"
- "3.3"
env:
- PYMONGO=dev
- PYMONGO=2.4.1
- PYMONGO=2.3
- PYMONGO=2.5
- PYMONGO=2.4.2
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then sudo apt-get install zlib1g zlib1g-dev; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install PIL --use-mirrors ; true; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install PIL --use-mirrors ; true; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install simplejson --use-mirrors ; true; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then cp /usr/lib/*/libz.so $VIRTUAL_ENV/lib/; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install pil --use-mirrors ; true; fi
- if [[ $PYMONGO == 'dev' ]]; then pip install https://github.com/mongodb/mongo-python-driver/tarball/master; true; fi
- if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO --use-mirrors; true; fi
- python setup.py install

View File

@ -145,3 +145,4 @@ that much better:
* Jared Forsyth
* Kenneth Falck
* Lukasz Balcerzak
* Aleksandr Sorokoumov

View File

@ -1,4 +1,4 @@
Copyright (c) 2009-2012 See AUTHORS
Copyright (c) 2009 See AUTHORS
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View File

@ -49,6 +49,12 @@ Changes in 0.8.X
- Updated Save so it calls $set and $unset in a single operation (#211)
- Fixed inner queryset looping (#204)
Changes in 0.7.10
=================
- Fixed cloning querysets in PY3
- Int fields no longer unset in save when changed to 0 (#272)
- Fixed ReferenceField query chaining bug fixed (#254)
Changes in 0.7.9
================
- Better fix handling for old style _types

View File

@ -1,5 +1,6 @@
import copy
import operator
import numbers
from functools import partial
import pymongo
@ -431,13 +432,13 @@ class BaseDocument(object):
# Determine if any changed items were actually unset.
for path, value in set_data.items():
if value or isinstance(value, bool):
if value or isinstance(value, (numbers.Number, bool)):
continue
# If we've set a value that ain't the default value dont unset it.
default = None
if (self._dynamic and len(parts) and
parts[0] in self._dynamic_fields):
if (self._dynamic and len(parts) and parts[0] in
self._dynamic_fields):
del(set_data[path])
unset_data[path] = 1
continue

View File

@ -58,7 +58,7 @@ if sys.version_info[0] == 3:
extra_opts['packages'].append("tests")
extra_opts['package_data'] = {"tests": ["fields/mongoengine.png"]}
else:
extra_opts['tests_require'] = ['nose', 'coverage', 'blinker', 'django>=1.3', 'PIL']
extra_opts['tests_require'] = ['nose', 'coverage', 'blinker', 'django==1.4.2', 'PIL']
extra_opts['packages'] = find_packages(exclude=('tests',))
setup(name='mongoengine',

View File

@ -69,7 +69,7 @@ class AllWarnings(unittest.TestCase):
p2.parent.name = "Poppa Wilson"
p2.save()
self.assertEqual(len(self.warning_list), 1)
self.assertTrue(len(self.warning_list) > 0)
if len(self.warning_list) > 1:
print self.warning_list
warning = self.warning_list[0]

View File

@ -241,7 +241,7 @@ class QuerySetTest(unittest.TestCase):
def test_none(self):
class A(Document):
pass
s = StringField()
A.drop_collection()
A().save()
@ -249,6 +249,31 @@ class QuerySetTest(unittest.TestCase):
self.assertEqual(list(A.objects.none()), [])
self.assertEqual(list(A.objects.none().all()), [])
class B(Document):
ref = ReferenceField(A)
boolfield = BooleanField(default=False)
A.drop_collection()
B.drop_collection()
a1 = A(s="test1").save()
a2 = A(s="test2").save()
B(ref=a1, boolfield=True).save()
# Works
q1 = B.objects.filter(ref__in=[a1, a2], ref=a1)._query
# Doesn't work
q2 = B.objects.filter(ref__in=[a1, a2])
q2 = q2.filter(ref=a1)._query
self.assertEqual(q1, q2)
a_objects = A.objects(s='test1')
query = B.objects(ref__in=a_objects)
query = query.filter(boolfield=True)
self.assertEquals(query.count(), 1)
def test_update_write_options(self):
"""Test that passing write_options works"""