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:
commit
04b85ddbf2
12
.travis.yml
12
.travis.yml
@ -2,21 +2,17 @@
|
|||||||
language: python
|
language: python
|
||||||
services: mongodb
|
services: mongodb
|
||||||
python:
|
python:
|
||||||
- "2.5"
|
|
||||||
- "2.6"
|
- "2.6"
|
||||||
- "2.7"
|
- "2.7"
|
||||||
- "3.2"
|
- "3.2"
|
||||||
- "3.3"
|
- "3.3"
|
||||||
env:
|
env:
|
||||||
- PYMONGO=dev
|
- PYMONGO=dev
|
||||||
- PYMONGO=2.4.1
|
- PYMONGO=2.5
|
||||||
- PYMONGO=2.3
|
- PYMONGO=2.4.2
|
||||||
install:
|
install:
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then sudo apt-get install zlib1g zlib1g-dev; fi
|
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then cp /usr/lib/*/libz.so $VIRTUAL_ENV/lib/; 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.'* ]]; then pip install PIL --use-mirrors ; true; fi
|
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install simplejson --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 https://github.com/mongodb/mongo-python-driver/tarball/master; true; fi
|
||||||
- if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO --use-mirrors; true; fi
|
- if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO --use-mirrors; true; fi
|
||||||
- python setup.py install
|
- python setup.py install
|
||||||
|
1
AUTHORS
1
AUTHORS
@ -145,3 +145,4 @@ that much better:
|
|||||||
* Jared Forsyth
|
* Jared Forsyth
|
||||||
* Kenneth Falck
|
* Kenneth Falck
|
||||||
* Lukasz Balcerzak
|
* Lukasz Balcerzak
|
||||||
|
* Aleksandr Sorokoumov
|
||||||
|
2
LICENSE
2
LICENSE
@ -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
|
Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation
|
obtaining a copy of this software and associated documentation
|
||||||
|
@ -49,6 +49,12 @@ Changes in 0.8.X
|
|||||||
- Updated Save so it calls $set and $unset in a single operation (#211)
|
- Updated Save so it calls $set and $unset in a single operation (#211)
|
||||||
- Fixed inner queryset looping (#204)
|
- 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
|
Changes in 0.7.9
|
||||||
================
|
================
|
||||||
- Better fix handling for old style _types
|
- Better fix handling for old style _types
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import copy
|
import copy
|
||||||
import operator
|
import operator
|
||||||
|
import numbers
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import pymongo
|
import pymongo
|
||||||
@ -431,13 +432,13 @@ class BaseDocument(object):
|
|||||||
|
|
||||||
# Determine if any changed items were actually unset.
|
# Determine if any changed items were actually unset.
|
||||||
for path, value in set_data.items():
|
for path, value in set_data.items():
|
||||||
if value or isinstance(value, bool):
|
if value or isinstance(value, (numbers.Number, bool)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If we've set a value that ain't the default value dont unset it.
|
# If we've set a value that ain't the default value dont unset it.
|
||||||
default = None
|
default = None
|
||||||
if (self._dynamic and len(parts) and
|
if (self._dynamic and len(parts) and parts[0] in
|
||||||
parts[0] in self._dynamic_fields):
|
self._dynamic_fields):
|
||||||
del(set_data[path])
|
del(set_data[path])
|
||||||
unset_data[path] = 1
|
unset_data[path] = 1
|
||||||
continue
|
continue
|
||||||
|
2
setup.py
2
setup.py
@ -58,7 +58,7 @@ if sys.version_info[0] == 3:
|
|||||||
extra_opts['packages'].append("tests")
|
extra_opts['packages'].append("tests")
|
||||||
extra_opts['package_data'] = {"tests": ["fields/mongoengine.png"]}
|
extra_opts['package_data'] = {"tests": ["fields/mongoengine.png"]}
|
||||||
else:
|
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',))
|
extra_opts['packages'] = find_packages(exclude=('tests',))
|
||||||
|
|
||||||
setup(name='mongoengine',
|
setup(name='mongoengine',
|
||||||
|
@ -69,7 +69,7 @@ class AllWarnings(unittest.TestCase):
|
|||||||
p2.parent.name = "Poppa Wilson"
|
p2.parent.name = "Poppa Wilson"
|
||||||
p2.save()
|
p2.save()
|
||||||
|
|
||||||
self.assertEqual(len(self.warning_list), 1)
|
self.assertTrue(len(self.warning_list) > 0)
|
||||||
if len(self.warning_list) > 1:
|
if len(self.warning_list) > 1:
|
||||||
print self.warning_list
|
print self.warning_list
|
||||||
warning = self.warning_list[0]
|
warning = self.warning_list[0]
|
||||||
@ -91,4 +91,4 @@ class AllWarnings(unittest.TestCase):
|
|||||||
InheritedDocumentFailTest._get_collection_name())
|
InheritedDocumentFailTest._get_collection_name())
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
sys.path[0:0] = [""]
|
sys.path[0:0] = [""]
|
||||||
|
@ -241,7 +241,7 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_none(self):
|
def test_none(self):
|
||||||
class A(Document):
|
class A(Document):
|
||||||
pass
|
s = StringField()
|
||||||
|
|
||||||
A.drop_collection()
|
A.drop_collection()
|
||||||
A().save()
|
A().save()
|
||||||
@ -249,6 +249,31 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
self.assertEqual(list(A.objects.none()), [])
|
self.assertEqual(list(A.objects.none()), [])
|
||||||
self.assertEqual(list(A.objects.none().all()), [])
|
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):
|
def test_update_write_options(self):
|
||||||
"""Test that passing write_options works"""
|
"""Test that passing write_options works"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user