db.commit is irrelevant to this question (without commit, you will not
persist the data out to the database - e.g., if you exit a shell, the db
won't be updated).

But the return to a db insert still should return the new ID.

Here's what I get from trunk (you should get something similar with your
table inserts):

$ python web2py.py -S welcome -M
default applications appear to be installed already
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2009
Version 1.67.0 (2009-09-07 16:11:06)
Database drivers available: SQLite3, MySQL, PostgreSQL
Starting cron...
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- An enhanced Interactive Python.

In [1]: for user in db().select(db.auth_user.ALL):
   ...:     print user.id, ": ", user.first_name
   ...:

In [2]: myID=db.auth_user.insert(first_name="I am Sam")

In [3]: myID
Out[3]: 1

In [4]: myID=db.auth_user.insert(first_name="I am Billy")

In [5]: myID
Out[5]: 2

In [6]: for user in db().select(db.auth_user.ALL):
   ...:     print user.id, ": ", user.first_name
   ...:
1 :  I am Sam
2 :  I am Billy

In [7]:


On Tue, Sep 8, 2009 at 7:06 PM, Bernardo Botelho <[email protected]>wrote:

> I've done some reading and i notice that running from the shell i should
> call db.commit. When i did that, it runs correctly.
>
> Thanks you all!
>
> --
> Bernardo Botelho Fontes
> [email protected]
> (21) 9629 1621
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to