Well, seems an easy task but i´m stuck

How can i get in app A a sqlform.smartgrid(db.auth_user) from app B?
db is B's db

in app A i call the app B module

from applications.B.modules.funcs import *
def calmais():
    return mais()



In app B
*in db.py*
current.db = db


*i have a module funcs.py*
inside...
def mais():
    db=current.db
    grid=SQLFORM.smartgrid(db.auth_user)
    return grid


i get the error

 File "applications\B\modules\funcs.py", line 6, in mais

    db=current.db
AttributeError: 'thread._local' object has no attribute 'db'

why cant i just use db inside a module and have to use current.db trick?




2013/6/6 António Ramos <ramstei...@gmail.com>

> gotcha
> from applications.myapp.modules.funcs import func
>
> Nice !
>
>
> 2013/6/6 António Ramos <ramstei...@gmail.com>
>
>> How do i import a module from another app?
>>
>>
>> 2013/6/5 Niphlod <niph...@gmail.com>
>>
>>> and.... nobody stops you to call other apps pages inside your "master"
>>> one, e.g., using LOAD, and "elect" a master app to take care of
>>> authorization with CAS.
>>>
>>> On Wednesday, June 5, 2013 7:21:39 PM UTC+2, Ramos wrote:
>>>
>>>> I have to check this ..
>>>>
>>>> *But you can put your SQLFORM in a module function and import it within
>>>> any application.*
>>>>
>>>>
>>>> 2013/6/5 Vinicius Assef <vinic...@gmail.com>
>>>>
>>>>> So, it doesn't make sense.
>>>>>
>>>>> But you can put your SQLFORM in a module function and import it within
>>>>> any application.
>>>>>
>>>>> On Wed, Jun 5, 2013 at 2:06 PM, António Ramos <ramst...@gmail.com>
>>>>> wrote:
>>>>> > it was app, not database i wanted to write
>>>>> >
>>>>> > table = SQLFORM.grid(app,
>>>>> >
>>>>> >                   query,
>>>>> >                   links=links,
>>>>> >                   deletable=False,
>>>>> >                   editable=False,
>>>>> >                   create=False
>>>>> >                  )
>>>>> >
>>>>> >
>>>>> >
>>>>> > 2013/6/5 Vinicius Assef <vinic...@gmail.com>
>>>>>
>>>>> >>
>>>>> >> The query parameter already has the database you wish.
>>>>> >>
>>>>> >> On Wed, Jun 5, 2013 at 1:41 PM, António Ramos <ramst...@gmail.com>
>>>>>
>>>>> >> wrote:
>>>>> >> > Hello,
>>>>> >> > One of the things i have to do daily using Lotus Notes in my
>>>>> company is
>>>>> >> > to
>>>>> >> > have a form to show a grid with documents from another app/table.
>>>>> >> >
>>>>> >> >
>>>>> >> > Short story
>>>>> >> > First , years ago, i created an app to manage all quality
>>>>> certificates
>>>>> >> > issued to the clients.
>>>>> >> > About 5000 a year total.
>>>>> >> > I have about 70.000 in that database.
>>>>> >> >
>>>>> >> > Second, after some time ,i created another database to record
>>>>> every
>>>>> >> > visit to
>>>>> >> > the clients.
>>>>> >> >
>>>>> >> > Third ,recently i had to create another app to manage Quality
>>>>> issues/Non
>>>>> >> > conformities.
>>>>> >> > Another context, another app.another Acess Control List,etc
>>>>> >> >
>>>>> >> > In the end, our Top executives saw the need to manage all of the
>>>>> clients
>>>>> >> > documents in one single screen.At last i created an ap to manage
>>>>> THE
>>>>> >> > CLIENT!!!
>>>>> >> > There was no  need to rewrite my apps or to import data,etc.
>>>>> >> > Lotus Notes can embed a view to show documents in another
>>>>> database with
>>>>> >> > just
>>>>> >> > the mouse click.
>>>>> >> > It was very easy inside Lotus Notes environment.In just some
>>>>> minutes it
>>>>> >> > was
>>>>> >> > DONE!!!
>>>>> >> >
>>>>> >> >
>>>>> >> > I wish web2py could have something like this
>>>>> >> >
>>>>> >> >
>>>>> >> > table = SQLFORM.grid(database,
>>>>> >> >
>>>>> >> >                   query,
>>>>> >> >                   links=links,
>>>>> >> >                   deletable=False,
>>>>> >> >                   editable=False,
>>>>> >> >                   create=False
>>>>> >> >                  )
>>>>> >> >
>>>>> >> > As Auth can be the same for the entire server apps , it would be
>>>>> nice to
>>>>> >> > share data as easily as possible.
>>>>> >> > That is a important need for an enterprise framework.
>>>>> >> >
>>>>> >> > Best regards
>>>>> >> >
>>>>> >> > António
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> > --
>>>>> >> >
>>>>> >> > ---
>>>>> >> > You received this message because you are subscribed to the Google
>>>>> >> > Groups
>>>>> >> > "web2py-users" group.
>>>>> >> > To unsubscribe from this group and stop receiving emails from it,
>>>>> send
>>>>> >> > an
>>>>> >> > email to web2py+un...@**googlegroups.com.
>>>>>
>>>>> >> > For more options, visit https://groups.google.com/**
>>>>> groups/opt_out <https://groups.google.com/groups/opt_out>.
>>>>> >> >
>>>>> >> >
>>>>> >>
>>>>> >> --
>>>>> >>
>>>>> >> ---
>>>>> >> You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> >> "web2py-users" group.
>>>>> >> To unsubscribe from this group and stop receiving emails from it,
>>>>> send an
>>>>> >> email to web2py+un...@**googlegroups.com.
>>>>>
>>>>> >> For more options, visit 
>>>>> >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>> >>
>>>>> >>
>>>>> >
>>>>> > --
>>>>> >
>>>>> > ---
>>>>> > You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> > "web2py-users" group.
>>>>> > To unsubscribe from this group and stop receiving emails from it,
>>>>> send an
>>>>> > email to web2py+un...@**googlegroups.com.
>>>>>
>>>>> > For more options, visit 
>>>>> > https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>> >
>>>>> >
>>>>>
>>>>> --
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "web2py-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to web2py+un...@**googlegroups.com.
>>>>>
>>>>> For more options, visit 
>>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to