Query a boolean property in NDB Python
<p>I have a Greeting model</p>

<pre><code>class Greeting(ndb.Model):
    author = ndb.StructuredProperty(Author)
    content = ndb.TextProperty(indexed=False)
    avatar = ndb.BlobProperty()
    date = ndb.DateTimeProperty(auto_now_add=True)
    public = ndb.BooleanProperty(default=False)
</code></pre>

<p>wherein I use the following code to query seven Greeting posts at each page in Python Google App Engine:</p>

<pre><code>posts_query = Greeting.query(
ancestor=session_key(session_name)).order(-Greeting.date)
curs = Cursor(urlsafe=self.request.get('cursor'))
posts,next_curs, more = posts_query.fetch_page(7, start_cursor=curs)
</code></pre>

<p>I wanted it to show only posts to that has public modified into True so I changed it into </p>

<pre><code>posts_query = Greeting.query(
ancestor=session_key(session_name), Greeting.public == True).order(-Greeting.date) #line changed
curs = Cursor(urlsafe=self.request.get('cursor'))
posts,next_curs, more = posts_query.fetch_page(7, start_cursor=curs)
</code></pre>

<p>However, it is giving me an error:</p>

<pre><code>File "/home/ralf/Desktop/google_projects/website/views/events.py", line 28
    Greeting.public == True).order(-Greeting.date)
SyntaxError: non-keyword arg after keyword arg
</code></pre>

<p>How can I fix this? What is the appropriate code for this kind of query? Help is greatly appreciated.</p>

<p>P.S. As you can see I am also using a query cursor.</p>

<p>I fixed it by using this </p>

<pre><code>posts_query = Greeting.query(Greeting.public == True).order(-Greeting.date)
</code></pre>

<p>instead of </p>

<pre><code>posts_query = Greeting.query(ancestor=session_key(session_name),
        Greeting.public == True).order(-Greeting.date)
</code></pre>

python google-app-engine app-engine-ndb