UndefinedError: 'None' has no attribute 'key'
<p>How would I access <code>{{c.key().id()}}</code> in my python file? It correctly prints out the correct id in my html. When I try to get the id from the request I get an error <code>UndefinedError: 'None' has no attribute 'key'</code> but if I set the <code>id</code> to something such as 
<code>id=5222955109842944</code> it works.</p>

<p>When I used <code>id= Comment.key().id()</code> I get  </p>

<pre><code>id = Comment.key.id
AttributeError: 'function' object has no attribute 'id'or id= Comment.key.id
</code></pre>

<p>When I tried <code>id = Comment.key()</code> I got</p>

<pre><code>id = Comment.key()
TypeError: unbound method key() must be called with Comment instance as first argument (got nothing instead)
</code></pre>

<p>I have this in my python file</p>

<pre><code>        #id=5222955109842944
        id = self.request.get('id')



        name = 'testname1'
        key = db.Key.from_path('Comment', id)

        comments = db.get(key)
</code></pre>

<p>When I try to get the id from the request I get an error <code>UndefinedError: 'None' has no attribute 'key'</code></p>

<p>This is in my html file:</p>

<pre><code>  comment id{{c.key().id()}}


  &lt;a href="/blog/editcomment?id={{c.key().id()}}"&gt;Edit Comment&lt;/a&gt;&lt;br&gt;&lt;br&gt;
</code></pre>

<p><code>self.request.get('id')</code> is a string.  You need to turn it into an <code>int</code>:</p>

<p><code>int(self.request.get('id'))</code></p>

python google-app-engine google-cloud-datastore