Christian,
Itried this in the gae sdk development console and replaced args with
a string as request not available and its just a quick test.
I copied the dal.py from trunk and replaced into my copy of last
stable release
I get there traceback listed below
#----the code in dev console------
from gluon.dal import *
db = DAL('gae')
db.define_table('funtest',
Field('name', length=128))
def create_one():
id = request.args[0]
from google.appengine.ext import db as gae
class funtest(gae.Expando):
name = gae.StringProperty(required=False)
item = funtest(key_name="label:"+id,name='bob')
item.put()
print "done"
def read_one():
id = "t"
from google.appengine.api.datastore_types import Key
from google.appengine.ext import db as gae
key = Key.from_path("funtest","label:"+id)
#this fails, unknown key exception
entity_keyid = db.funtest[key]
entity_keyselect = db(db.funtest.id == key).select().first()
entity_keyid2 = db.funtest(key) #this returns None
from google.appengine.ext import db as gae
entity_gae = gae.get(key)
print entity_keyselect
print entity_keyid2
print entity_gae
print "done"
create_one()
read_one()
#------returns--
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\admin\__init__.py", line 295, in post
exec(compiled_code, globals())
File "<string>", line 20, in <module>
File "<string>", line 11, in read_one
File "C:\web2py\gluon\dal.py", line 4922, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'agtkZXZ-aWFyZ3UtYXIUCxIHZnVudGVzdCIHbGFiZWw6dAw'
#-------------------------------------------------------------------
On Oct 15, 5:01 pm, howesc <[email protected]> wrote:
> groups wouldn't let me attache a file. here's the text:
>
> diff -r 57544ce34efe gluon/dal.py
> --- a/gluon/dal.py Wed Oct 12 21:53:13 2011 -0500
> +++ b/gluon/dal.py Sat Oct 15 08:54:00 2011 -0700
> @@ -3385,7 +3385,7 @@
> (items, tablename, fields) =
> self.select_raw(query,fields,attributes)
> # self.db['_lastsql'] = self._select(query,fields,attributes)
> rows = [
> - [t=='id' and int(item.key().id()) or getattr(item, t) for t in
> fields]
> + [t=='id' and (int(item.key().id()) if item.key().id() else
> item.key().name()) or getattr(item, t) for t in fields]
> for item in items]
> colnames = ['%s.%s' % (tablename, t) for t in fields]
> return self.parse(rows, colnames, False)