Hi Massimo.

Yes the problem is not with the sqlite. I just confirmed that it does work 
and the session table is in the databases folder.

My Oracle db already has the auth tables and web2py_session table defined. 
I suspect there is a null value for the user field since no one would be 
logged in when the app comes up. Somehow that is OK with SQL lite.

Here are the session variables:
Variables 
 session <Storage {'auth': None, '_user_agent': {'os': {'...ser': {'version'
: '15.0.1', 'name': 'Firefox'}}}> 
 request <Storage {'function': 'index', 'body': <cStringI...lications\\
TAMOTO\\', 'post_vars': <Storage {}>}> 
 session._try_store_in_db <bound method Session._try_store_in_db of 
<Stora...er': {'version': '15.0.1', 'name': 'Firefox'}}}>> 
 response <Storage {'body': <cStringIO.StringO object at 0...a> at 
0x03FE8F30>, 'view': 'default/index.html'}>


As I mentioned earlier. This is a brand new application. No tables other 
than auth_ and web2py_session_ defined here yet.

-Bill

On Monday, October 15, 2012 4:30:17 PM UTC-5, Massimo Di Pierro wrote:
>
> I am using sqlite and I tried sessions in db (again) and I cannot 
> reproduce this problem.
>
> On Monday, 15 October 2012 16:03:45 UTC-5, Bill Thayer wrote:
>>
>> Thought I'd start over with a brand new application & get the wiki 
>> working but I am running into difficulty before I even get to the wiki part.
>> I created a brand new app and started by moving my 0.py file into models 
>> then edited db.py like so:
>>
>>
>> if not request.env.web2py_runtime_gae:
>>     ## if NOT running on Google App Engine use SQLite or other DB
>>     db = DAL(settings.database_uri, check_reserved=['oracle'])    
>>     ## store sessions and tickets there
>>     session.connect(request, response, db=db, migrate=
>> 'db.web2py_session_tamoto')
>> else:
>> .
>> .
>> .
>>
>>
>> ## create all tables needed by auth if not custom tables
>> auth.define_tables(username=True, signature=False, migrate=False)
>>
>>
>>
>> Of course I get an Oracle Error:
>>
>> Traceback (most recent call last):
>>  File "C:\web2py_src_2.1.1\web2py\gluon\restricted.py", line 209, 
>> inrestricted
>>  exec ccode in environment
>>  File 
>> "C:/web2py_src_2.1.1/web2py/applications/TAMOTO/models/db.py"<http://127.0.0.1:8000/admin/default/edit/TAMOTO/models/db.py>
>> , line 16, in <module>
>>  session.connect(request, response, db=db, migrate=
>> 'db.web2py_session_tamoto')
>>  File "C:\web2py_src_2.1.1\web2py\gluon\globals.py", line 581, in connect
>>  migrate=table_migrate,
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 7092, indefine_table
>>  table = self.lazy_define_table(tablename,*fields,**args)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 7124, 
>> inlazy_define_table
>>  polymodel=polymodel)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 920, increate_table
>>  self.create_sequence_and_triggers(query,table)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 2865, 
>> increate_sequence_and_triggers
>>  self.execute(query)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 2856, in execute
>>  return self.log_execute(command, args)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 1687, inlog_execute
>>  ret = self.cursor.execute(*a, **b)
>> DatabaseError: ORA-00955: name is already used by an existing object
>>
>>
>> Thought I might give writing a patch a try so I tried catching and ignoring 
>> the exception in the OracleAdaptor but it does not work.
>>
>> After setting migrate_enabled to False:
>>     db = DAL(settings.database_uri, check_reserved=['oracle'], 
>> migrate_enabled=False) 
>>
>>    
>> I get this error:
>> Traceback (most recent call last):
>>  File "C:\web2py_src_2.1.1\web2py\gluon\main.py", line 541, in wsgibase
>>  session._try_store_in_db(request, response)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\globals.py", line 670, in 
>> _try_store_in_db
>>  record_id = table.insert(**dd)
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 7812, in insert
>>  return ret
>>  File "C:\web2py_src_2.1.1\web2py\gluon\dal.py", line 1160, in insert
>>  raise e
>> IntegrityError: ORA-01400: cannot insert NULL into 
>> ("UWAVEDAT"."WEB2PY_SESSION_TAMOTO"."ID")
>>
>>
>>
>>

-- 



Reply via email to