Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-11-01 Thread Massimo Di Pierro
Sorry for my late reply.

You do not need response.generic_patterns = ['json'] as the generic view is not 
used when you return a string.

The error is a serialization error. What's in the model?




On Oct 23, 2011, at 12:20 PM, Phyo Arkar wrote:

 def get_items():
   response.generic_patterns = ['json']
   query=(db.item.id=0)
   return response.json(db(query).select(db.item.id,db.item.name))



Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-11-01 Thread Phyo Arkar
the model is :

db.define_table(item,
  SQLField(name, text, length=512, notnull=True, default=None),
  SQLField(base_price, integer, notnull=True, default=None),
  SQLField(price, integer, notnull=True, default=None)
  )



Table definition

from datetime import date
import time

db.define_table(sale,
  SQLField(id_items, db.item),
  SQLField(date, date, notnull=True, default=date.today()),
  SQLField(sale_time, datetime, notnull=True, default=request.now),
  SQLField(total_items, integer, notnull=True, default=None),
  SQLField(description, text, notnull=False, default=None))


it was fixed now after i changed =0 into 0 .

On 11/1/11, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Sorry for my late reply.

 You do not need response.generic_patterns = ['json'] as the generic view is
 not used when you return a string.

 The error is a serialization error. What's in the model?




 On Oct 23, 2011, at 12:20 PM, Phyo Arkar wrote:

 def get_items():
  response.generic_patterns = ['json']
  query=(db.item.id=0)
  return response.json(db(query).select(db.item.id,db.item.name))




Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-11-01 Thread Phyo Arkar
ah i changed a bit much :

here is the new code (the problem fixed there)

def get_items():

response.generic_patterns = ['json']
query=(db.item.id0)
items=db(query).select(db.item.id,db.item.name)
return response.json(items)

On 11/2/11, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 the model is :

 db.define_table(item,
   SQLField(name, text, length=512, notnull=True, default=None),
   SQLField(base_price, integer, notnull=True, default=None),
   SQLField(price, integer, notnull=True, default=None)
   )


 
 Table definition
 
 from datetime import date
 import time

 db.define_table(sale,
   SQLField(id_items, db.item),
   SQLField(date, date, notnull=True, default=date.today()),
   SQLField(sale_time, datetime, notnull=True, default=request.now),
   SQLField(total_items, integer, notnull=True, default=None),
   SQLField(description, text, notnull=False, default=None))


 it was fixed now after i changed =0 into 0 .

 On 11/1/11, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Sorry for my late reply.

 You do not need response.generic_patterns = ['json'] as the generic view
 is
 not used when you return a string.

 The error is a serialization error. What's in the model?




 On Oct 23, 2011, at 12:20 PM, Phyo Arkar wrote:

 def get_items():
 response.generic_patterns = ['json']
 query=(db.item.id=0)
 return response.json(db(query).select(db.item.id,db.item.name))





Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-10-23 Thread Phyo Arkar
any idea?

On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 I am using 1.98.2

 here is my model :

 db.define_table(item,
   SQLField(name, text, length=512, notnull=True, default=None),
   SQLField(base_price, integer, notnull=True, default=None),
   SQLField(price, integer, notnull=True, default=None)
   )


 
 Table definition
 
 from datetime import date
 import time

 db.define_table(sale,
   SQLField(id_items, db.item),
   SQLField(date, date, notnull=True, default=date.today()),
   SQLField(sale_time, datetime, notnull=True, default=request.now),
   SQLField(total_items, integer, notnull=True, default=None),
   SQLField(description, text, notnull=False, default=None))

 On Sun, Oct 23, 2011 at 5:43 AM, howesc how...@umich.edu wrote:

 what's the model?

 what version of web2py are you using?




Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-10-23 Thread Phyo Arkar
Massimo , can you check is that a bug of web2py?

I got BadValueError , using 1.98.2 version on GAE

Controller is very simple :

def get_items():
response.generic_patterns = ['json']
query=(db.item.id=0)
return response.json(db(query).select(db.item.id,db.item.name))

Thats it.

Regards

Phyo.
On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 any idea?

 On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 I am using 1.98.2

 here is my model :

 db.define_table(item,
   SQLField(name, text, length=512, notnull=True, default=None),
   SQLField(base_price, integer, notnull=True, default=None),
   SQLField(price, integer, notnull=True, default=None)
   )


 
 Table definition
 
 from datetime import date
 import time

 db.define_table(sale,
   SQLField(id_items, db.item),
   SQLField(date, date, notnull=True, default=date.today()),
   SQLField(sale_time, datetime, notnull=True,
 default=request.now),
   SQLField(total_items, integer, notnull=True, default=None),
   SQLField(description, text, notnull=False, default=None))

 On Sun, Oct 23, 2011 at 5:43 AM, howesc how...@umich.edu wrote:

 what's the model?

 what version of web2py are you using?





[web2py][GAE]BadValueError: Incomplete key found for reference property

2011-10-22 Thread Phyo Arkar
Here is another GAE error:



While i am doing this :

def get_items():
response.generic_patterns = ['json']
query=(db.item.id=0)
#out=[{name: Fusion Noodle}, {name: Burger Jumbo}, {name: 
Sushi}]
return response.json(db(query).select(db.item.id,db.item.name))




I get:



Traceback (most recent call last):
  File 
/base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py,
line 192, in restricted
exec ccode in environment
  File 
/base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_items,
line 218, in module
  File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py,
line 145, in lambda
self._caller = lambda f: f()
  File 
/base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_items,
line 160, in get_items
  File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py,
line 5481, in select
return self.db._adapter.select(self.query,fields,attributes)
  File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py,
line 3296, in select
for item in items]
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py,
line 2029, in __iter__
return self.run()
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py,
line 2012, in run
raw_query = self._get_query()
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py,
line 2376, in _get_query
_app=self._app)
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py,
line 1328, in __init__
self.update(filters)
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py,
line 1783, in update
self.__setitem__(filter, value)
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py,
line 1726, in __setitem__
datastore_types.ValidateProperty(' ', value, read_only=True)
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore_types.py,
line 1478, in ValidateProperty
prop_validator(name, v)
  File 
/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore_types.py,
line 1392, in ValidatePropertyKey
'Incomplete key found for reference property %s.' % name)
BadValueError: Incomplete key found for reference property


Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-10-22 Thread howesc
what's the model?

what version of web2py are you using?


Re: [web2py][GAE]BadValueError: Incomplete key found for reference property

2011-10-22 Thread Phyo Arkar
I am using 1.98.2

here is my model :

db.define_table(item,
  SQLField(name, text, length=512, notnull=True, default=None),
  SQLField(base_price, integer, notnull=True, default=None),
  SQLField(price, integer, notnull=True, default=None)
  )



Table definition

from datetime import date
import time

db.define_table(sale,
  SQLField(id_items, db.item),
  SQLField(date, date, notnull=True, default=date.today()),
  SQLField(sale_time, datetime, notnull=True, default=request.now),
  SQLField(total_items, integer, notnull=True, default=None),
  SQLField(description, text, notnull=False, default=None))

On Sun, Oct 23, 2011 at 5:43 AM, howesc how...@umich.edu wrote:

 what's the model?

 what version of web2py are you using?