The capitalized SA was just an editing error, please disregard.

The thing is, i have two applications, each with one form...

def add_ip():
    id=request.args(0)
    if db(db.ip.cr==user_id).count()==0:
        form=crud.update(db.ip,id,next='view_ip')
    else:
        redirect(URL(r=request,f='view_ip'))
    return dict(form=form)

...that writes the data into those two databases, and i need
to have one field that is unique in both of those dbs.
Just think of two copies of the exact same application(first post),
with the db definitions(first two lines) reversed.

Now the problem is that when i fill out a form with application#1,
and then do the same thing with application#2 using the exact value
for ipo.sa, i'm not getting an error...




On 13 Σεπτ, 19:02, mdipierro <[email protected]> wrote:
> Yes you can do it but it is
>
> db.ipo.sa.requires
>
> not
>
> db.ipo.SA.requires
>
> On Sep 13, 10:46 am, cogarg <[email protected]> wrote:
>
> > Is the following even possible?
>
> > db = SQLDB('postgres://xx:x...@localhost:5432/xx')
> > dblink = SQLDB('postgres://yy:y...@localhost:5432/yy')
>
> > db.define_table('ipo',
> >     Field('sa',label=T('SA')),
> >     Field('cr',db.auth_user,default=auth.user_id,writable=False),
> >     Field('ep',label=T('EPI'),default=user_lastname))
>
> > dblink.define_table('ipo', Field('sa'), Field('cr'), Field('ep'))
>
> > db.ipo.SA.requires = [
> > IS_NOT_IN_DB(db, 'ipo.sa', error_message=T('Already in db') + '!'),
> > IS_NOT_IN_DB(dblink, 'ipo.sa', error_message=T('Already in dblink') +
> > '!')
> > ]
>
> > Thanks in advance
>
>

Reply via email to