Re: [web2py] Re: talks

2011-07-04 Thread Nick Arnett
On Mon, Jul 4, 2011 at 7:13 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It is somewhere in San Francisco. I only have 20minutes and I am told to expect a tough crowd (mostly Django people). I will be driving to SF from Lake Tahoe just for that. What should I cover? I should be

Re: [web2py] SQL UNIQUE IN WEB2PY : CONSTRAINT unique_test UNIQUE (num_part1, num_part2, num_part3, title)

2011-07-02 Thread Nick Arnett
On Fri, Jul 1, 2011 at 1:20 AM, Bruno Rocha rochacbr...@gmail.com wrote: Db.define_table('foo',Field('a'),Field('b'), Field('ab',unique=True, compute=lambda r: r.a + r.b)) This failed for me with sqlite and I see from other discussions that the same is true with Django - sqlite throws an error

[web2py] Best practice for inserting possible duplicates?

2011-07-02 Thread Nick Arnett
Getting more comfortable with Web2Py and there sure is a lot to like about it. I'm wondering what is considered best practice for inserting records that might already exist, when I also want to get the id of the record if it does exist. I haven't come across a shortcut for this. For now, I'm

Re: [web2py] Re: Best practice for inserting possible duplicates?

2011-07-02 Thread Nick Arnett
On Sat, Jul 2, 2011 at 7:39 PM, Anthony abasta...@gmail.com wrote: Be careful about using an 'except' without specifying specific exception types -- that code will attempt an insert regardless of the reason for the failure in the 'try' clause. I was wondering if someone would mention that...

Re: [web2py] SQL UNIQUE IN WEB2PY : CONSTRAINT unique_test UNIQUE (num_part1, num_part2, num_part3, title)

2011-06-30 Thread Nick Arnett
On Thu, Jun 30, 2011 at 4:15 PM, Anthony abasta...@gmail.com wrote: IS_NOT_IN_DB does take a DAL Set object as the first argument, so you can limit the records checked to a particular set within the table (see http://web2py.com/book/default/chapter/07#Database-Validators). However, I'm not

Re: [web2py] SQL UNIQUE IN WEB2PY : CONSTRAINT unique_test UNIQUE (num_part1, num_part2, num_part3, title)

2011-06-30 Thread Nick Arnett
On Thu, Jun 30, 2011 at 6:43 PM, Nick Arnett nick.arn...@gmail.com wrote: On Thu, Jun 30, 2011 at 4:15 PM, Anthony abasta...@gmail.com wrote: IS_NOT_IN_DB does take a DAL Set object as the first argument, so you can limit the records checked to a particular set within the table (see http

Re: [web2py] SQL UNIQUE IN WEB2PY : CONSTRAINT unique_test UNIQUE (num_part1, num_part2, num_part3, title)

2011-06-30 Thread Nick Arnett
On Thu, Jun 30, 2011 at 7:00 PM, Anthony abasta...@gmail.com wrote: I don't think web2py automatically creates any indexes -- see http://web2py.com/book/default/chapter/06#Indexes. It has to! Can't have primary keys without them. But I see what you mean, looking at the docs. I guess I

[web2py] Use the ORM for a robot?

2011-06-29 Thread Nick Arnett
I'm just getting to know Web2Py after working with Django a fair bit. I have robots that gather data that I would like to insert using the Web2Py ORM, but I can't quite figure out the right way to do that. If I put the bot scripts in the modules directory, I don't seem to have access to the ORM.