Massimo,

I'm sending you a copy of my code.

Thanks.

On Nov 22, 8:12 pm, morningovermidnight <[EMAIL PROTECTED]>
wrote:
> Thanks for all the help and looking into this...
>
> I tried the sql.py, placing it at gluon/sql.py, still without success.
> I did notice output to the terminal:
>
> error: 'session_id_public'
> error: char buffer type not available
>
> Not sure what's going on.
>
> On Nov 22, 12:05 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > Can you try if this fixes the problem?
>
> >http://groups.google.com/group/web2py/web/sql.py
>
> > Massimo
>
> > On Nov 22, 10:47 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > on the case. May be a bug.
>
> > > Massimo
>
> > > On Nov 22, 3:50 am, morningovermidnight <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > How can I fix that? I tried using session.connect(request, response,
> > > > db) instead of session.connect(request, response, db=db,
> > > > tablename='session_record'), but I still get the same thing...no
> > > > session info. I did a clean of my cookies, .table files, and restarted
> > > > the server. It did create a new table, web2y_session_office, but still
> > > > is not returning the session flashes.
>
> > > > On Nov 22, 1:56 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > Yes!
>
> > > > > That is the problem. Your session_data is 'text' while it should be
> > > > > 'bytea'. web2py is attempting a migration losing data and postgres
> > > > > does not allow copy text into a bytea.
>
> > > > > Massimo
>
> > > > > On Nov 22, 12:26 am, morningovermidnight <[EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > > > Ok, with version 1.51 running I added the line to gluon/globals.py.
> > > > > > Here's the message returned:
>
> > > > > > Traceback (most recent call last):
> > > > > >   File "/home/basic/workbench/sites/newsite/gluon/restricted.py", 
> > > > > > line
> > > > > > 62, in restricted
> > > > > >     exec ccode in environment
> > > > > >   File 
> > > > > > "/home/basic/workbench/sites/newsite/applications/office/models/
> > > > > > db.py", line 7, in <module>
> > > > > >     session.connect(request, response, db=db,
> > > > > > tablename='session_record')
> > > > > >   File "/home/basic/workbench/sites/newsite/gluon/globals.py", line
> > > > > > 160, in connect
> > > > > >     db.Field('session_data','blob'),migrate=table_migrate)
> > > > > >   File "/home/basic/workbench/sites/newsite/gluon/sql.py", line 567,
> > > > > > in define_table
> > > > > >     raise e
> > > > > > ProgrammingError: column "session_data__tmp" is of type bytea but
> > > > > > expression is of type text
> > > > > > LINE 2: UPDATE session_record_office SET
> > > > > > session_data__tmp=session_d...
> > > > > >                                          ^
> > > > > > HINT:  You will need to rewrite or cast the expression.
>
> > > > > > Is this because I defined my own table name for sessions? Should I
> > > > > > just let web2py handle that?
>
> > > > > > On Nov 21, 8:46 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I did a diff of 1.51 vs 1.47. As I remembered the only think that
> > > > > > > changed in session management is storing the pickle from 'text' to
> > > > > > > 'blob'. This actually fixed a problem with sessions in mysql, as
> > > > > > > pointed out by CJ.
>
> > > > > > > Please do a test for me. In gluon/globals.py
>
> > > > > > > replace these lines with:
>
> > > > > > >              except Exception, e:
> > > > > > >                  
> > > > > > > record_id,unique_key,session_data=None,str(uuid.uuid4
> > > > > > > ()),{}
>
> > > > > > > with
>
> > > > > > >              except Exception, e:
> > > > > > >                  print 'error:',e
> > > > > > >                  
> > > > > > > record_id,unique_key,session_data=None,str(uuid.uuid4
> > > > > > > ()),{}
>
> > > > > > > and tell me what it prints, if anything.
>
> > > > > > > Massimo
>
> > > > > > > On Nov 21, 4:25 pm, morningovermidnight <[EMAIL PROTECTED]>
> > > > > > > wrote:
>
> > > > > > > > Ok, I tried it out...removed the .table files, dropped the 
> > > > > > > > session
> > > > > > > > table, removed cookies, still same problem...nothing being 
> > > > > > > > returned
> > > > > > > > from sessions. Specifically, I have a login form. When the wrong
> > > > > > > > username is entered, there is a session flash that says "invalid
> > > > > > > > username". This doesn't show with web2py version 1.51. After 
> > > > > > > > doing
> > > > > > > > what you mentioned above and it still not working, I dropped 
> > > > > > > > the 1.47
> > > > > > > > source into my application folder to downgrade back to version 
> > > > > > > > 1.47,
> > > > > > > > started the server, and now my session flash works flawlessly.
>
> > > > > > > > On Nov 21, 4:57 pm, morningovermidnight <[EMAIL PROTECTED]>
> > > > > > > > wrote:
>
> > > > > > > > > I am using PostgreSQL, but I will try what you recommend and 
> > > > > > > > > let you
> > > > > > > > > know how it works out.
>
> > > > > > > > > On Nov 21, 3:57 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > > Are you using mysql? The problem may be a bug in web2py 
> > > > > > > > > > 1.47 that has
> > > > > > > > > > been fixed in an non-backward incompatible way. In 1.47 a 
> > > > > > > > > > session was
> > > > > > > > > > picked in a text field. In mysql text fields cannot be 
> > > > > > > > > > longer than
> > > > > > > > > > 2**16 bytes. So since 1.48 they are pickled in a blob.
>
> > > > > > > > > > Try 1.51 again but please drop the web2py_session table and 
> > > > > > > > > > remove the
> > > > > > > > > > corresponding .table file from the databases folder. The 
> > > > > > > > > > clear
> > > > > > > > > > cookies. Let me know if this fixes the problem.
>
> > > > > > > > > > Massimo
>
> > > > > > > > > > On Nov 21, 2:48 pm, morningovermidnight <[EMAIL PROTECTED]>
> > > > > > > > > > wrote:
>
> > > > > > > > > > > Thanks for the reply. I tried deleting all sessions from 
> > > > > > > > > > > the database,
> > > > > > > > > > > still did not solve the problem for me. In doing some 
> > > > > > > > > > > investigation to
> > > > > > > > > > > solve the problem, I changed my web2py version from 1.51 
> > > > > > > > > > > to version
> > > > > > > > > > > 1.47 (replaced files with the 1.47 source). Now, 
> > > > > > > > > > > everything works
> > > > > > > > > > > perfectly. Not sure if some of my code is incompatible 
> > > > > > > > > > > with version
> > > > > > > > > > > 1.51 or not, but I'll be sticking with 1.47 for now at 
> > > > > > > > > > > least...
>
> > > > > > > > > > > Thanks
>
> > > > > > > > > > > On Nov 21, 3:31 pm, kev <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > > > > Try deleting all the session from the database.
>
> > > > > > > > > > > > On Nov 21, 2:51 pm, morningovermidnight <[EMAIL 
> > > > > > > > > > > > PROTECTED]>
> > > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > I'm not sure what's happening. It was all working 
> > > > > > > > > > > > > before. I was
> > > > > > > > > > > > > storing sessions in the database and working with 
> > > > > > > > > > > > > them throughout my
> > > > > > > > > > > > > application with no problem. Now, it seems suddenly, 
> > > > > > > > > > > > > sessions have
> > > > > > > > > > > > > stopped working. I don't get a session.flash or any 
> > > > > > > > > > > > > other session
> > > > > > > > > > > > > objects returned. When I comment out the 
> > > > > > > > > > > > > session.connect(request,
> > > > > > > > > > > > > response, db=db, tablename='session_record') to store 
> > > > > > > > > > > > > sessions on the
> > > > > > > > > > > > > filesystem, everything then works perfectly. Once I 
> > > > > > > > > > > > > uncomment that
> > > > > > > > > > > > > line to store in the database again, I can no longer 
> > > > > > > > > > > > > access my
> > > > > > > > > > > > > session. I checked the database...there are session 
> > > > > > > > > > > > > records being
> > > > > > > > > > > > > recorded in the database, but for whatever reason 
> > > > > > > > > > > > > they are not being
> > > > > > > > > > > > > returned to the application? Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to