Negative ghostrider. You can't currently add a field that references a
field in another database. It throws an error:

db = DAL('...')
authdb = DAL('...')
auth = Auth(globals(), authdb)
db.define_table('poll',Field('author',auth.settings.table_user))

Traceback (most recent call last):
  File "C:\Users\nathan_freeze\workspace\web2py\gluon\restricted.py",
line 178, in restricted
    exec ccode in environment
  File "C:/Users/nathan_freeze/workspace/web2py/applications/test/
models/db.py", line 63, in <module>
    db.define_table('poll',Field('author',auth.settings.table_user))
  File "C:\Users\nathan_freeze\workspace\web2py\gluon\sql.py", line
1304, in define_table
    t._create_references()
  File "C:\Users\nathan_freeze\workspace\web2py\gluon\sql.py", line
1576, in _create_references
    raise SyntaxError, 'Table: table "%s" does not exist' % referenced
SyntaxError: Table: table "auth_user" does not exist

On Jul 24, 7:07 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Not sure what you mean. This works already.
>
> On Jul 24, 7:03 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > How difficult would it be to patch the DAL to make this work?
>
> > On Jul 24, 7:00 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Caveat... if two apps point to the same db make sure only one of them
> > > has migrate=True and all the others have migrate=False for all table
> > > or things result in a mess.
>
> > > On Jul 24, 6:59 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > The DAL(...) function has a path attribute and you can make it point
> > > > to the folder of another app.
>
> > > > On Jul 24, 3:56 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > The main purpose is to easily allow many apps to share an established
> > > > > auth db.  You wouldn't need to decorate controllers any differently
> > > > > because the DAL instance is passed to the constructor of Auth, not to
> > > > > the decorator. If anything, I would suspect a performance gain as you
> > > > > would be splitting the load over multiple database servers.
>
> > > > > On Jul 24, 3:44 pm, weheh <richard_gor...@verizon.net> wrote:
>
> > > > > > I like the potential flexibility but am not sure what the purpose
> > > > > > would be for having a separate auth db? What if you then had 
> > > > > > multiple
> > > > > > auth dbs? Wouldn't you need to decorate controllers with the name of
> > > > > > the auth db to search in? Wouldn't there be a performance penalty 
> > > > > > for
> > > > > > opening up links to multiple dbs?
>
> > > > > > On Jul 24, 2:20 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > > I was attempting to completely separate my auth db from my data 
> > > > > > > db and
> > > > > > > realized this isn't currently possible but potentially could be:
>
> > > > > > > db = DAL('...')
> > > > > > > authdb = DAL('...')
> > > > > > > auth = Auth(globals(), authdb)
> > > > > > > db.define_table('poll',Field('author',auth.settings.table_user))
>
> > > > > > > Two questions:
> > > > > > > Is this a crazy idea?
> > > > > > > Could the DAL be modified to handle this?
>
>

Reply via email to