alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

_last_reference not being set in new dal #182

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From dly...@gmail.com on February 06, 2011 06:46:47

What steps will reproduce the problem? 1. run a web2py app on GAE

  1. attempt to use _last_reference

What is the expected output? _last_reference What do you see instead? exception What version of the product are you using? On what operating system? Please provide any additional information below. In dal.py: def insert(self,table,fields): dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields)

table._db['_lastsql'] = self._insert(table,fields)

    tmp = table._tableobj(**dfields) 
    tmp.put() 
    table._db['_last_reference'] = tmp # Suggested patch based on 

June 27/2010 mod in the trunk rid = Reference(tmp.key().id()) (rid._table, rid._record) = (table, None) return rid

Original issue: http://code.google.com/p/web2py/issues/detail?id=184

alfonsodg commented 10 years ago

From massimo....@gmail.com on February 06, 2011 07:39:20

I think you refer to last_sql. No it is not being set in new dal. That is bug and there is already a ticket about it. Thanks for reporting it.

Status: Duplicate

alfonsodg commented 10 years ago

From dly...@gmail.com on February 06, 2011 17:47:18

_last_reference is different than last_sql _last_reference is the native GAE datastore key to the underlying entity returned from an insert.

So I believe it is still an issue.

I tested my proposed patch on my own machine and it works - I was able to set it and get it later.