Skip to content

Commit 24a8b6a

Browse files
committed
Merge branch 'master' of github.com:samuelclay/mongoengine
* 'master' of github.com:samuelclay/mongoengine: (227 commits) Adding QuerySet(read_preference=pymongo.ReadPreference.X) and QuerySet().read_preference() method to override connection-level read_preference on a per-query basis. Fixing py3 compat Added chaining regression test (MongoEngine#135) Updated test Unicode fix for repr (MongoEngine#133) Allow updates with match operators (MongoEngine#144) Unicode fix reverted but can have custom validator Fix loop Updated URLField Added Garry Polley to contributors list can now use AuthenticationBackends with permissions. Updates to the readme Added CONTRIBUTING.rst Updated docs thanks @mitar Moved injection of Exceptions to top level Fixed reload issue with ReferenceField where dbref=False (MongoEngine#138) Improved import cache Fixed objectId for DBRef Updated travis.yml Fix ReferenceField dbref = False ...
2 parents 457fb09 + edc4664 commit 24a8b6a

40 files changed

+4211
-1359
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ env/
1313
.settings
1414
.project
1515
.pydevproject
16-
tests/bugfix.py
16+
tests/test_bugfix.py
17+
htmlcov/

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# http://travis-ci.org/#!/MongoEngine/mongoengine
2+
language: python
3+
services: mongodb
4+
python:
5+
- 2.5
6+
- 2.6
7+
- 2.7
8+
- 3.1
9+
- 3.2
10+
env:
11+
- PYMONGO=dev
12+
- PYMONGO=2.3
13+
- PYMONGO=2.2
14+
install:
15+
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then sudo apt-get install zlib1g zlib1g-dev; fi
16+
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/; fi
17+
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install PIL --use-mirrors ; true; fi
18+
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install PIL --use-mirrors ; true; fi
19+
- if [[ $PYMONGO == 'dev' ]]; then pip install https://github.com/mongodb/mongo-python-driver/tarball/master; true; fi
20+
- if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO --use-mirrors; true; fi
21+
- python setup.py install
22+
script:
23+
- python setup.py test
24+
notifications:
25+
irc: "irc.freenode.org#mongoengine"
26+
branches:
27+
only:
28+
- master
29+
- 0.7

AUTHORS

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Florian Schlachter <[email protected]>
88
Steve Challis <[email protected]>
99
Wilson Júnior <[email protected]>
1010
Dan Crosta https://github.com/dcrosta
11+
Laine Herron https://github.com/LaineHerron
1112

1213
CONTRIBUTORS
1314

@@ -102,4 +103,24 @@ that much better:
102103
* mostlystatic
103104
* Greg Banks
104105
* swashbuckler
105-
* Adam Reeve
106+
* Adam Reeve
107+
* Anthony Nemitz
108+
* deignacio
109+
* shaunduncan
110+
* Meir Kriheli
111+
* Andrey Fedoseev
112+
* aparajita
113+
* Tristan Escalada
114+
* Alexander Koshelev
115+
* Jaime Irurzun
116+
* Alexandre González
117+
* Thomas Steinacher
118+
* Tommi Komulainen
119+
* Peter Landry
120+
* biszkoptwielki
121+
* Anton Kolechkin
122+
* Sergey Nikitin
123+
* psychogenic
124+
* Stefan Wójcik
125+
* dimonb
126+
* Garry Polley

CONTRIBUTING.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Contributing to MongoEngine
2+
===========================
3+
4+
MongoEngine has a large `community
5+
<https://raw.github.com/MongoEngine/mongoengine/master/AUTHORS>`_ and
6+
contributions are always encouraged. Contributions can be as simple as
7+
minor tweaks to the documentation. Please read these guidelines before
8+
sending a pull request.
9+
10+
Bugfixes and New Features
11+
-------------------------
12+
13+
Before starting to write code, look for existing `tickets
14+
<https://github.com/MongoEngine/mongoengine/issues?state=open>`_ or `create one
15+
<https://github.com/MongoEngine/mongoengine/issues>`_ for your specific
16+
issue or feature request. That way you avoid working on something
17+
that might not be of interest or that has already been addressed. If in doubt
18+
post to the `user group <http://groups.google.com/group/mongoengine-users>`
19+
20+
Supported Interpreters
21+
----------------------
22+
23+
PyMongo supports CPython 2.5 and newer. Language
24+
features not supported by all interpreters can not be used.
25+
Please also ensure that your code is properly converted by
26+
`2to3 <http://docs.python.org/library/2to3.html>`_ for Python 3 support.
27+
28+
Style Guide
29+
-----------
30+
31+
MongoEngine aims to follow `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_
32+
including 4 space indents and 79 character line limits.
33+
34+
Testing
35+
-------
36+
37+
All tests are run on `Travis <http://travis-ci.org/MongoEngine/mongoengine>`_
38+
and any pull requests are automatically tested by Travis. Any pull requests
39+
without tests will take longer to be integrated and might be refused.
40+
41+
General Guidelines
42+
------------------
43+
44+
- Avoid backward breaking changes if at all possible.
45+
- Write inline documentation for new classes and methods.
46+
- Write tests and make sure they pass (make sure you have a mongod
47+
running on the default port, then execute ``python setup.py test``
48+
from the cmd line to run the test suite).
49+
- Add yourself to AUTHORS.rst :)
50+
51+
Documentation
52+
-------------
53+
54+
To contribute to the `API documentation
55+
<http://docs.mongoengine.org/en/latest/apireference.html>`_
56+
just make your changes to the inline documentation of the appropriate
57+
`source code <https://github.com/MongoEngine/mongoengine>`_ or `rst file
58+
<https://github.com/MongoEngine/mongoengine/tree/master/docs>`_ in a
59+
branch and submit a `pull request <https://help.github.com/articles/using-pull-requests>`_.
60+
You might also use the github `Edit <https://github.com/blog/844-forking-with-the-edit-button>`_
61+
button.

LICENSE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Copyright (c) 2009-2010 Harry Marr
2-
1+
Copyright (c) 2009-2012 See AUTHORS
2+
33
Permission is hereby granted, free of charge, to any person
44
obtaining a copy of this software and associated documentation
55
files (the "Software"), to deal in the Software without
@@ -8,10 +8,10 @@ copy, modify, merge, publish, distribute, sublicense, and/or sell
88
copies of the Software, and to permit persons to whom the
99
Software is furnished to do so, subject to the following
1010
conditions:
11-
11+
1212
The above copyright notice and this permission notice shall be
1313
included in all copies or substantial portions of the Software.
14-
14+
1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1616
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1717
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

README.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
MongoEngine
33
===========
44
:Info: MongoEngine is an ORM-like layer on top of PyMongo.
5+
:Repository: https://github.com/MongoEngine/mongoengine
56
:Author: Harry Marr (http://github.com/hmarr)
67
:Maintainer: Ross Lawley (http://github.com/rozza)
78

9+
.. image:: https://secure.travis-ci.org/MongoEngine/mongoengine.png?branch=master
10+
:target: http://travis-ci.org/MongoEngine/mongoengine
11+
812
About
913
=====
1014
MongoEngine is a Python Object-Document Mapper for working with MongoDB.
@@ -22,7 +26,7 @@ setup.py install``.
2226

2327
Dependencies
2428
============
25-
- pymongo 1.1+
29+
- pymongo 2.1.1+
2630
- sphinx (optional - for documentation generation)
2731

2832
Examples
@@ -59,11 +63,6 @@ Some simple examples of what MongoEngine code looks like::
5963
... print 'Link:', post.url
6064
... print
6165
...
62-
=== Using MongoEngine ===
63-
See the tutorial
64-
65-
=== MongoEngine Docs ===
66-
Link: hmarr.com/mongoengine
6766

6867
>>> len(BlogPost.objects)
6968
2
@@ -81,18 +80,16 @@ Some simple examples of what MongoEngine code looks like::
8180
Tests
8281
=====
8382
To run the test suite, ensure you are running a local instance of MongoDB on
84-
the standard port, and run ``python setup.py test``.
83+
the standard port, and run: ``python setup.py test``.
8584

8685
Community
8786
=========
8887
- `MongoEngine Users mailing list
8988
<http://groups.google.com/group/mongoengine-users>`_
9089
- `MongoEngine Developers mailing list
9190
<http://groups.google.com/group/mongoengine-dev>`_
92-
- `#mongoengine IRC channel <irc://irc.freenode.net/mongoengine>`_
91+
- `#mongoengine IRC channel <http://webchat.freenode.net/?channels=mongoengine>`_
9392

9493
Contributing
9594
============
96-
The source is available on `GitHub <http://github.com/MongoEngine/mongoengine>`_ - to
97-
contribute to the project, fork it on GitHub and send a pull request, all
98-
contributions and suggestions are welcome!
95+
We welcome contributions! see the`Contribution guidelines <https://github.com/MongoEngine/mongoengine/blob/master/CONTRIBUTING.rst>`_

benchmark.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,64 @@ def main():
2828
2929
----------------------------------------------------------------------------------------------------
3030
Creating 10000 dictionaries - Pymongo
31-
1.1141769886
31+
3.86744189262
3232
----------------------------------------------------------------------------------------------------
3333
Creating 10000 dictionaries - MongoEngine
34-
2.37724113464
34+
6.23374891281
3535
----------------------------------------------------------------------------------------------------
3636
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False
37-
1.92479610443
37+
5.33027005196
38+
----------------------------------------------------------------------------------------------------
39+
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False, cascade=False
40+
pass - No Cascade
3841
3942
0.5.X
4043
----------------------------------------------------------------------------------------------------
4144
Creating 10000 dictionaries - Pymongo
42-
1.10552310944
45+
3.89597702026
46+
----------------------------------------------------------------------------------------------------
47+
Creating 10000 dictionaries - MongoEngine
48+
21.7735359669
49+
----------------------------------------------------------------------------------------------------
50+
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False
51+
19.8670389652
52+
----------------------------------------------------------------------------------------------------
53+
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False, cascade=False
54+
pass - No Cascade
55+
56+
0.6.X
57+
----------------------------------------------------------------------------------------------------
58+
Creating 10000 dictionaries - Pymongo
59+
3.81559205055
4360
----------------------------------------------------------------------------------------------------
4461
Creating 10000 dictionaries - MongoEngine
45-
16.5169169903
62+
10.0446798801
4663
----------------------------------------------------------------------------------------------------
4764
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False
48-
14.9446101189
65+
9.51354718208
4966
----------------------------------------------------------------------------------------------------
5067
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False, cascade=False
51-
14.912801981
68+
9.02567505836
5269
----------------------------------------------------------------------------------------------------
5370
Creating 10000 dictionaries - MongoEngine, force=True
54-
14.9617750645
71+
8.44933390617
5572
56-
Performance
73+
0.7.X
5774
----------------------------------------------------------------------------------------------------
5875
Creating 10000 dictionaries - Pymongo
59-
1.10072994232
76+
3.78801012039
6077
----------------------------------------------------------------------------------------------------
6178
Creating 10000 dictionaries - MongoEngine
62-
5.27341103554
79+
9.73050498962
6380
----------------------------------------------------------------------------------------------------
6481
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False
65-
4.49365401268
82+
8.33456707001
6683
----------------------------------------------------------------------------------------------------
6784
Creating 10000 dictionaries - MongoEngine, safe=False, validate=False, cascade=False
68-
4.43459296227
85+
8.37778115273
6986
----------------------------------------------------------------------------------------------------
7087
Creating 10000 dictionaries - MongoEngine, force=True
71-
4.40114378929
88+
8.36906409264
7289
"""
7390

7491
setup = """

docs/apireference.rst

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,28 @@ Querying
4747
Fields
4848
======
4949

50-
.. autoclass:: mongoengine.StringField
51-
.. autoclass:: mongoengine.URLField
50+
.. autoclass:: mongoengine.BinaryField
51+
.. autoclass:: mongoengine.BooleanField
52+
.. autoclass:: mongoengine.ComplexDateTimeField
53+
.. autoclass:: mongoengine.DateTimeField
54+
.. autoclass:: mongoengine.DecimalField
55+
.. autoclass:: mongoengine.DictField
56+
.. autoclass:: mongoengine.DynamicField
5257
.. autoclass:: mongoengine.EmailField
53-
.. autoclass:: mongoengine.IntField
58+
.. autoclass:: mongoengine.EmbeddedDocumentField
59+
.. autoclass:: mongoengine.FileField
5460
.. autoclass:: mongoengine.FloatField
55-
.. autoclass:: mongoengine.DecimalField
56-
.. autoclass:: mongoengine.DateTimeField
57-
.. autoclass:: mongoengine.ComplexDateTimeField
61+
.. autoclass:: mongoengine.GenericEmbeddedDocumentField
62+
.. autoclass:: mongoengine.GenericReferenceField
63+
.. autoclass:: mongoengine.GeoPointField
64+
.. autoclass:: mongoengine.ImageField
65+
.. autoclass:: mongoengine.IntField
5866
.. autoclass:: mongoengine.ListField
59-
.. autoclass:: mongoengine.SortedListField
60-
.. autoclass:: mongoengine.DictField
6167
.. autoclass:: mongoengine.MapField
6268
.. autoclass:: mongoengine.ObjectIdField
6369
.. autoclass:: mongoengine.ReferenceField
64-
.. autoclass:: mongoengine.GenericReferenceField
65-
.. autoclass:: mongoengine.EmbeddedDocumentField
66-
.. autoclass:: mongoengine.GenericEmbeddedDocumentField
67-
.. autoclass:: mongoengine.BooleanField
68-
.. autoclass:: mongoengine.FileField
69-
.. autoclass:: mongoengine.BinaryField
70-
.. autoclass:: mongoengine.GeoPointField
7170
.. autoclass:: mongoengine.SequenceField
71+
.. autoclass:: mongoengine.SortedListField
72+
.. autoclass:: mongoengine.StringField
73+
.. autoclass:: mongoengine.URLField
74+
.. autoclass:: mongoengine.UUIDField

0 commit comments

Comments
 (0)