Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Filtering KeyProperty with None will throw error. #77

Closed
GoogleCodeExporter opened this issue Jun 10, 2015 · 3 comments
Closed

Filtering KeyProperty with None will throw error. #77

GoogleCodeExporter opened this issue Jun 10, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. declare KeyProperty on Model

class Test(model.Model):
    k = model.KeyProperty()
    value = model.IntegerProperty()

2. filtering KeyProperty with None

Test.query(Test.k == None).count() # error
Test.query(Test.k != None).count() # error also

What is the expected output? What do you see instead?

File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-de
fault.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_we
bapp25.py", line 701, in __call__
    handler.get(*groups)
File "/Users/reiot/Documents/Works/ndbtest/main.py", line 91, in get
    count = Test.query(Test.k == None).count() # error
File "/Users/reiot/Documents/Works/ndbtest/ndb/model.py", line 500, in __eq__
    return self._comparison('=', value)
File "/Users/reiot/Documents/Works/ndbtest/ndb/model.py", line 491, in 
_comparison
    return FilterNode(self._name, op, self._datastore_type(value))
File "/Users/reiot/Documents/Works/ndbtest/ndb/model.py", line 1138, in 
_datastore_type
    return datastore_types.Key(value.urlsafe())
AttributeError: 'NoneType' object has no attribute 'urlsafe'

What version of the product are you using? On what operating system?

0.7 & 0.8

Please provide any additional information below.


Original issue reported on code.google.com by Reio...@gmail.com on 11 Oct 2011 at 11:16

@GoogleCodeExporter
Copy link
Author

Good one!  Thanks for reporting.

Original comment by guido@google.com on 11 Oct 2011 at 2:37

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Double trouble: many other types have the same problem!  I am fixing them all.

Original comment by gvanrossum@gmail.com on 11 Oct 2011 at 4:02

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision ba347f7a5e61.

Original comment by guido@google.com on 11 Oct 2011 at 4:02

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant