Where do I insert the code? In model?

this is now my code in db.py

if session['school_db'] != request.cookies['mycookie'].value:
        auth.logout()
        session['school_db'] = request.cookies['mycookie'].value

But I get an error 
'NoneType' object has no attribute 'insert'

seems like smth is wrong with auth.logout()

On Friday, September 21, 2012 6:03:59 PM UTC+2, Massimo Di Pierro wrote:
>
> After login your user info is loaded into session. You need to add 
> something like
>
> if session.dbname != current_db_name:
>     auth.logout()
>     session.dbname = current_db_name
>
>
> On Friday, 21 September 2012 07:47:08 UTC-5, Yebach wrote:
>>
>> Hello
>>
>> You can see my app on portal.iurnik.si  <http://portal.urnik.si>
>>
>> I have the following problem 
>> after user selects a school app connects to a specific database where 
>> data is read from. On that database the auth tables are created so 
>> registered users can download some documents.
>> The problems occurs if I log in on one school (database) and then I go 
>> back to main page, select a new database I am already logged in. How?? I 
>> mean auth tables are created on db but the user is not. How can I solve 
>> this?
>>
>> I am reading database name from cookie
>>
>> Thank you
>>
>>
>>

-- 



Reply via email to