[web2py] Re: db.company.insert() error

2017-09-01 Thread Val K
I believe, that between inserts/updates and selects you should do commit On Friday, September 1, 2017 at 10:15:00 PM UTC+3, Dave S wrote: > > > > On Friday, September 1, 2017 at 10:03:48 AM UTC-7, Ben Lawrence wrote: >> >> Also, if i am inserting within a for loop, should I place the db.commit()

[web2py] Re: db.company.insert() error

2017-09-01 Thread Dave S
On Friday, September 1, 2017 at 10:03:48 AM UTC-7, Ben Lawrence wrote: > > Also, if i am inserting within a for loop, should I place the db.commit() > within the for loop too? > > On Friday, September 1, 2017 at 9:59:11 AM UTC-7, Ben Lawrence wrote: >> >> Good point, but I put the commits after

[web2py] Re: db.company.insert() error

2017-09-01 Thread Ben Lawrence
Also, if i am inserting within a for loop, should I place the db.commit() within the for loop too? On Friday, September 1, 2017 at 9:59:11 AM UTC-7, Ben Lawrence wrote: > > Good point, but I put the commits after the function returns as there are > a number of inserts in a variety of tables. So

[web2py] Re: db.company.insert() error

2017-09-01 Thread Ben Lawrence
Good point, but I put the commits after the function returns as there are a number of inserts in a variety of tables. So is it preferred to do a commit after every insert instead of grouping them together for one big commit? TIA Ben On Friday, September 1, 2017 at 12:35:01 AM UTC-7, Val K

[web2py] Re: db.company.insert() error

2017-09-01 Thread Val K
from the book: Remember to call db.commit() at the end of every task if it involves inserts/updates to the database. web2py commits by default at the end of a successful action but the scheduler tasks are not actions. On Friday, September 1, 2017 at 8:30:00 AM UTC+3, Ben Lawrence wrote: > >

[web2py] Re: db.company.insert() error

2017-08-31 Thread Ben Lawrence
Thanks guys for your time. No I do not know what a _before_insert hook is, so I doubt that there is one here. here is def insert_company(valid_name, valid_email): """ Inserts a company record if there is a new

[web2py] Re: db.company.insert() error

2017-08-30 Thread Val K
As I see, it's a scheduler task - show all code of insert_company Is there any _before_insert hook? On Wednesday, August 30, 2017 at 1:22:57 AM UTC+3, Ben Lawrence wrote: > > 2.15.3-stable+timestamp.2017.08.07.07.32.04 > (Running on nginx/1.10.3, Python 2.7.12) > > > Hi > I hesitate to ask this

[web2py] Re: db.company.insert() error

2017-08-29 Thread Ben Lawrence
def get_company_name(s): """Takes out common domain suffixes e.g. com, net :param s: domain name :type s: string :returns: sanitized string :rtype: unicode string """ return (((s.replace('.com',' ')).replace('.net',' '))\ .replace('.org',' '))\

[web2py] Re: db.company.insert() error

2017-08-29 Thread Anthony
What does the get_company_name() function look like? On Tuesday, August 29, 2017 at 6:22:57 PM UTC-4, Ben Lawrence wrote: > > 2.15.3-stable+timestamp.2017.08.07.07.32.04 > (Running on nginx/1.10.3, Python 2.7.12) > > > Hi > I hesitate to ask this because it will betray my stupidity > > I have