1744 Commits

Author SHA1 Message Date
Ross Lawley
5447c6e947 DateTimeField now auto converts valid datetime isostrings into dates (#343) 2013-06-04 09:08:13 +00:00
Ross Lawley
f1b97fbc8b Merge pull request #343 from matchbox/dateutil
if `dateutil` is available, use it to parse datetimes
2013-06-04 01:22:31 -07:00
Ross Lawley
4c8dfc3fc2 Fixed Doc.objects(read_preference=X) not setting read preference (#352) 2013-06-03 15:40:54 +00:00
Ross Lawley
ceece5a7e2 Improved PIL detection for tests 2013-06-03 13:38:58 +00:00
Ross Lawley
7e6b035ca2 Added hensom to AUTHORS #329 2013-06-03 13:32:30 +00:00
Ross Lawley
fbc46a52af Updated changelog 2013-06-03 13:31:42 +00:00
Ross Lawley
8d2e7b4372 Django session ttl index expiry fixed (#329) 2013-06-03 13:31:35 +00:00
Ross Lawley
e7da9144f5 Merge pull request #342 from elasticsales/fix-pickle-loads
Fix for pickle.loads
2013-06-03 06:20:21 -07:00
Ross Lawley
2128e169f3 Merge branch 'master' of github.com:MongoEngine/mongoengine 2013-06-03 13:14:21 +00:00
Ross Lawley
8410d64daa Merge pull request #337 from jinzhang273/patch-1
Corrected some typos in django.rst
2013-06-03 06:13:59 -07:00
Ross Lawley
b2f78fadd9 Added test for upsert & update_one #336 2013-06-03 13:05:52 +00:00
Ross Lawley
3656323f25 Merge pull request #335 from ryanwitt/patch-2
minor typos in documentation
2013-06-03 06:03:59 -07:00
Ross Lawley
2fe1c20475 Added Jiequan to AUTHORS #354 2013-06-03 13:03:07 +00:00
Ross Lawley
0fb976a80a Added Ryan to AUTHORS #334 2013-06-03 13:01:48 +00:00
Ross Lawley
3cf62de753 Merge pull request #334 from ryanwitt/patch-1
fix link to guide from tutorial
2013-06-03 06:00:48 -07:00
Ross Lawley
06119b306d Merge pull request #354 from Jiequan/patch-1
Update upgrade.rst: Added docs for the new function clean()
2013-06-03 05:56:56 -07:00
Jiequan
0493bbbc76 Update upgrade.rst
Added docs for the new function: clean()
2013-06-02 20:46:51 +08:00
Nigel McNie
4c9e90732e Apply defaults to fields with None value at 'set' time.
If a field has a default, and you explicitly set it to None, the
behaviour before this patch was very confusing:

    class Person(Document):
        created = DateTimeField(default=datetime.datetime.utcnow)

    >>> p = Person(created=None)
    >>> p.created
    datetime.datetime(2013, 5, 30, 0, 18, 20, 242628)
    >>> p.created
    datetime.datetime(2013, 5, 30, 0, 18, 20, 995248)
    >>> p.created
    datetime.datetime(2013, 5, 30, 0, 18, 21, 370578)

It would be stored as None, and then at 'get' time, the default would be
applied. As you can see, if the default is a generator, this leads to some
crazy behaviour.

There's an argument that if I asked it to be set to None, why not respect that?
But I don't think that's how the rest of mongoengine seems to work (for
example, setting a field to None seems to mean it doesn't even get set in mongo
- as opposed to being set but with a 'null' value). Besides, as the code shows
above, you'd expect p.created to return None. So clearly, mongoengine is
already expecting None to mean 'default' where a default is available.

This bug also interacts nastily with required=True - if you're forcibly setting
the field to None, then at validation time, the None will fail validation
despite a perfectly valid default being available.

With this patch, when the field is set, the default is immediately applied.
This means any generation happens once, the getter always returns the same
value, and 'required' validation always respects the default.

Note: this breakage seems to be new since mongoengine 0.8.
2013-05-30 16:37:40 +12:00
Alice Bevan-McGregor
35f084ba76 Fixed :module: reference in docs and added myself to authors. 2013-05-29 13:23:18 -04:00
Alice Bevan-McGregor
f28f336026 Improved signals documentation and some typo fixes. 2013-05-29 13:17:08 -04:00
Alice Bevan-McGregor
122d75f677 Added pre_save_validation to signal list in documentation. 2013-05-29 12:23:32 -04:00
Alice Bevan-McGregor
12f6a3f5a3 Added tests for pre_save_validation and updated tests for pre_save to encompass created flag. 2013-05-29 12:22:15 -04:00
Alice Bevan-McGregor
5d44e1d6ca Added missing reference in __all__. 2013-05-29 12:12:51 -04:00
Alice Bevan-McGregor
04592c876b Moved pre_save after validation and determination of creation state; added pre_save_validation where pre_save had been. 2013-05-29 12:04:53 -04:00
Paul Swartz
c0571beec8 fix change tracking for ComplexBaseFields 2013-05-28 17:19:46 -04:00
Paul Swartz
1302316eb0 add some tests 2013-05-28 16:08:33 -04:00
Paul Swartz
18d8008b89 if dateutil is available, use it to parse datetimes
In particular, this picks up the default `datetime.isoformat()` output, with
a "T" as the separator.
2013-05-28 15:59:32 -04:00
Stefan Wojcik
4670f09a67 fix __set_state__ 2013-05-27 13:48:02 -07:00
ichuang
159ef12ed7 FileField should pass db_alias to GridFSProxy in __set__ call 2013-05-27 11:19:34 -04:00
Jin Zhang
7a760f5640 Update django.rst 2013-05-25 06:46:23 -06:00
Ryan Witt
2b6c42a56c minor typos 2013-05-24 11:34:15 -03:00
Ryan Witt
ab4ff99105 fix guide link 2013-05-24 11:24:40 -03:00
Stefan Wojcik
774895ec8c dont simplify queries with duplicate conditions 2013-05-23 17:49:28 -07:00
Ross Lawley
c5ce96c391 Fix py3 test 2013-05-23 19:44:05 +00:00
Ross Lawley
b4a98a4000 More upgrade clarifications #331 2013-05-23 19:30:57 +00:00
Ross Lawley
5f0d86f509 Upgrade doc fix (#330) 2013-05-23 19:12:13 +00:00
Ross Lawley
c96a1b00cf Documentation cleanup (#328) 2013-05-23 19:09:05 +00:00
Ross Lawley
1eb6436682 Added get image by grid_id example 2013-05-22 10:29:45 +00:00
Ross Lawley
a84e1f17bb Fixing django tests for py 2.6 2013-05-21 09:42:22 +00:00
Ross Lawley
3ffc9dffc2 Updated requirements for test suite v0.8.1 2013-05-21 09:37:22 +00:00
Ross Lawley
048c84ab95 Merge branch 'master' of github.com:MongoEngine/mongoengine 2013-05-21 09:12:38 +00:00
Ross Lawley
a7470360d2 Version bump 2013-05-21 09:12:09 +00:00
Ross Lawley
50f1ca91d4 Updated Changelog 2013-05-21 09:05:55 +00:00
Ross Lawley
0d37e1cd98 Merge pull request #326 from mitar/importlib-python26
importlib does not exist on Python 2.6. Use Django version.
2013-05-21 00:19:29 -07:00
Ross Lawley
9aa77bb3c9 Fixed pickle unsaved document regression (#327) 2013-05-21 07:07:17 +00:00
Ross Lawley
fd11244966 Merge pull request #327 from elasticsales/pickle-error
Document is not picklable before it is saved
2013-05-21 00:05:00 -07:00
Stefan Wojcik
d060da094f update pickling test case to show the error 2013-05-20 17:40:56 -07:00
Mitar
306f9c5ffd importlib does not exist on Python 2.6. Use Django version. 2013-05-20 17:30:41 -07:00
Ross Lawley
5ef5611682 0.8.0 is a go v0.8.0 2013-05-20 12:34:47 +00:00
Ross Lawley
ebdd2d730c Fixed querying ReferenceField custom_id (#317) 2013-05-20 10:20:43 +00:00