alanhzh / instant-press

Automatically exported from code.google.com/p/instant-press
GNU General Public License v2.0
0 stars 0 forks source link

key error #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Platform:
      instantpress_beta6.zip
      web2py Current Version 1.91.6 (2011-01-03 17:55:14)
      GAE sdk 1.4 (appspot.com)

I have deployed a instant press on GAE with the latest web2py 1.91.6 .
I can use site admin panel to add a new article, but can not change its title. 
The error logs from GAE as below:
--------------------------------------
  File "/base/data/home/apps/alwin-tsui/1.347534738843685938/applications/blog/controllers/siteadmin.py:articles", line 1175, in <module>
  File "/base/data/home/apps/alwin-tsui/1.347534738843685938/gluon/globals.py", line 95, in <lambda>
    self._caller = lambda f: f()
  File "/base/data/home/apps/alwin-tsui/1.347534738843685938/applications/blog/controllers/siteadmin.py:articles", line 93, in articles
  File "applications/blog/modules/articles.py", line 1357, in change_title
    count = db((db.posts.name == flat_name)&(db.posts.id != id)).count()
  File "/base/data/home/apps/alwin-tsui/1.347534738843685938/gluon/dal.py", line 4505, in count
    return self.db._adapter.count(self.query)
  File "/base/data/home/apps/alwin-tsui/1.347534738843685938/gluon/dal.py", line 2693, in count
    return items.count(limit=None)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1799, in count
    raw_query = self._get_query()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 2092, in _get_query
    namespace=self._namespace)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1022, in __init__
    self.update(filters)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1463, in update
    self.__setitem__(filter, value)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1410, in __setitem__
    match = self._CheckFilter(filter, value)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1542, in _CheckFilter
    (datastore_types._KEY_SPECIAL_PROPERTY, value, typename(value)))
BadFilterError: BadFilterError: invalid filter: __key__ filter value must be a 
Key; received 108002 (a long).
----------------------

I says we can not use id filter like 'db.posts.id != id', because id is not key 
property but long type.
where does this bug come from? instantpress, web2py or GAE?

Original issue reported on code.google.com by alwinT...@gmail.com on 14 Jan 2011 at 1:05

GoogleCodeExporter commented 8 years ago
I think is web2py issue, was fixed 2 days ago. 

http://code.google.com/p/web2py/issues/detail?id=154&can=1&start=100

Can you test with web2py trunk?

Original comment by mulone.m...@gmail.com on 14 Jan 2011 at 11:07

GoogleCodeExporter commented 8 years ago
Thank you,I tested it successful after it fixed. 

In addition, we have to uncomment line 2447 of dal.py like below:
    from google.appengine.api.datastore_types import Key  ### why was this needed????

Otherwise, we will meet NameError as:
  File "gluon/dal.py", line 2577, in NE
    second = Key.from_path(first._tablename, long(second))
NameError: global name 'Key' is not defined

Thank you very much!

Original comment by alwinT...@gmail.com on 15 Jan 2011 at 3:00