Re: [web2py] Re: Set table name

2012-01-16 Thread Marcello Parra
I pass db to module... Works fine... But I was setting (in the model): dog = 'dog12345' So.. in the module I see db and not dog... To make it work, I should pass dog also As I have many associations in this project, this wold make it almost impossible to implement On Mon, Jan 16, 201

Re: [web2py] Re: Set table name

2012-01-16 Thread Marin Pranjić
On Sat, Jan 14, 2012 at 6:21 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > eventually we shoud have a way to remap table and field names that was > one of the main reason for rewriting the dal. > > This is good because without remapping apps cannot share the same database (ie common

[web2py] Re: Set table name

2012-01-16 Thread Marcello
Would be great This solution works great... but it's not accessible in the modules files, because dog is not visible there... On 14 jan, 15:21, Massimo Di Pierro wrote: > eventually we shoud have a way to remap table and field names that was > one of the main reason for rewriting the dal.

[web2py] Re: Set table name

2012-01-14 Thread Massimo Di Pierro
eventually we shoud have a way to remap table and field names that was one of the main reason for rewriting the dal. On Jan 10, 10:51 am, Marcello Parra wrote: > Hello Massimo and all, > > I'm trying to use web2py for several projects of mine. > I always find a problem that should be solved if I

Re: [web2py] Re: Set table name

2012-01-13 Thread Marcello Parra
Anthony, thanks very much On Fri, Jan 13, 2012 at 12:03 PM, Anthony wrote: > Thanks a lot. >> This solved the problem >> >> Two questions: >> >> - why the brackets ?? >> > > Tables and fields can be accessed as properties via the usual "." > notation, but also via keys like a dictionar

Re: [web2py] Re: Set table name

2012-01-13 Thread Anthony
> > Thanks a lot. > This solved the problem > > Two questions: > > - why the brackets ?? > Tables and fields can be accessed as properties via the usual "." notation, but also via keys like a dictionary. So, db['tablename'] is equivalent to db.tablename and db.tablename['fieldname']is equi

Re: [web2py] Re: Set table name

2012-01-13 Thread Marcello Parra
Marin, Thanks a lot. This solved the problem Two questions: - why the brackets ?? - is this the most "elegant" what to do this ?? Thanks... On Fri, Jan 13, 2012 at 11:45 AM, Marin Pranjić wrote: > Try this, > > dog = 'dog12345' > db.person[1][dog].select() > > On Fri, Jan 13, 2012 at

Re: [web2py] Re: Set table name

2012-01-13 Thread Marin Pranjić
Try this, dog = 'dog12345' db.person[1][dog].select() On Fri, Jan 13, 2012 at 2:37 PM, Marcello Parra wrote: > Thanks Ross > > I tried this, but did not work: > > - db.person[1].dog.select() raises: > KeyError: 'dog' > > but > - db.person[1].dog12345.select() > works fine > > > > On

Re: [web2py] Re: Set table name

2012-01-13 Thread Marcello Parra
Thanks Ross I tried this, but did not work: - db.person[1].dog.select() raises: KeyError: 'dog' but - db.person[1].dog12345.select() works fine On Fri, Jan 13, 2012 at 10:46 AM, Ross Peoples wrote: > I don't know if anyone has tried this kind of thing before. The only idea > I ha

[web2py] Re: Set table name

2012-01-13 Thread Ross Peoples
I don't know if anyone has tried this kind of thing before. The only idea I have right now is to alias your table objects. This MIGHT work, or might make things worse :) Either way, try this and see if it works (no promises): db.define_table('person12345', Field('name'), ) db.person = db.per

[web2py] Re: Set table name

2012-01-13 Thread Marcello
No one ?? On 10 jan, 14:51, Marcello Parra wrote: > Hello Massimo and all, > > I'm trying to use web2py for several projects of mine. > I always find a problem that should be solved if I could set the table name. > > Let me show an example... > > Suppose that I have this: > > db.define_table('per