limeuser / appengine-ndb-experiment

Automatically exported from code.google.com/p/appengine-ndb-experiment
Other
0 stars 0 forks source link

required and default shouldn't be mutally exclusive #236

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I get
ValueError: repeated, required and default are mutally exclusive.
on
count = ndb.IntegerProperty(required=True, default=1)

In old datastore API it was possible to have required and default together on a 
property. For me this combination makes sense. For example someone might want 
to instantiate a model class without having to specify a value but with a 
default value. To avoid someone to override that value to None a required flag 
would be nice.

Using google_appengine_1.7.0

Original issue reported on code.google.com by bastian....@gmail.com on 11 Jan 2013 at 10:00

GoogleCodeExporter commented 9 years ago
I support this feature request.  When I wrote NDB I was unclear on the meaning 
of 'required' (never having used it myself).  It means "can't write a value of 
None".  That is quite compatible with specifying a default.

Original comment by gvanrossum@gmail.com on 14 Jan 2013 at 4:13

GoogleCodeExporter commented 9 years ago
I don't understand why it is not possible to have default and required? I too 
think this combination makes sense.

Original comment by dw...@versature.com on 15 May 2013 at 12:42

GoogleCodeExporter commented 9 years ago
Sadly I am too busy to implement this.  But if you want to contribute a patch, 
I'll review it and present it to the Googlers who own NDB now for inclusion.

Original comment by gvanrossum@gmail.com on 15 May 2013 at 2:50

GoogleCodeExporter commented 9 years ago
Hello. This is the patch for the mutual usage of default and required, keeping 
aside any combination of the above with repeated. 

Kind regards,

Dimitrios Kanellopoulos

Original comment by jimmyka...@gmail.com on 23 May 2013 at 3:35

Attachments:

GoogleCodeExporter commented 9 years ago
This is the second patch that fixes the broken tests

Original comment by jimmyka...@gmail.com on 30 May 2013 at 12:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! I uploaded this to https://codereview.appspot.com/9713043/ after adding 
"is not None" to your change to _is_initialized() (and reformatting it).

Original comment by gvanrossum@gmail.com on 30 May 2013 at 11:35

GoogleCodeExporter commented 9 years ago

Original comment by arful...@google.com on 12 Jun 2013 at 11:45

GoogleCodeExporter commented 9 years ago
Will be fixed in 1.8.3

Original comment by arful...@google.com on 25 Jun 2013 at 1:25

GoogleCodeExporter commented 9 years ago
Alfred, could you sync the external repo with the internal one? Or are you 
abandoning the external repo?  There's stuff in the 1.8.2 release that's not 
yet in the external repo, and while you've accepted this patch, it's not in the 
external repo either (and I'm hesitant to check it in myself because of 
interference with the 1.8.2. release patches).

Original comment by gvanrossum@gmail.com on 23 Jul 2013 at 9:24

GoogleCodeExporter commented 9 years ago
I believe the only change not synced in 1.8.2 are minor import changes (if
not please correct me). I plan on updating the external repo soon for the
1.8.3 changes.

Original comment by arful...@google.com on 24 Jul 2013 at 9:29

GoogleCodeExporter commented 9 years ago
Did you hg push? I see a ton of differences between the 1.8.2 SDK and the repo. 
 The last change was April 14: 
https://code.google.com/p/appengine-ndb-experiment/source/list?name=default

Original comment by gvanrossum@gmail.com on 24 Jul 2013 at 9:33

GoogleCodeExporter commented 9 years ago
Ah, you are right, distinct support missed the 1.7.7 golden cl and went out
in 1.8.0. I'll fix the repo.

Original comment by arful...@google.com on 24 Jul 2013 at 11:14