session problem

42 views
Skip to first unread message

mengu

unread,
Dec 25, 2009, 2:49:09 AM12/25/09
to web.py
hi everyone,

i'm having "AttributeError: 'function' object has no attribute
'add_processor'" exception, why is that? i'm using mod_wsgi with
webpy.

here is how i define app and session:
app = web.application(urls, globals()).wsgifunc()
store = web.session.DBStore(db, 'sessions')
session = web.session.Session(app, store, initializer={'count': 0})

thanks.

Anand Chitipothu

unread,
Dec 25, 2009, 2:53:50 AM12/25/09
to we...@googlegroups.com
> here is how i define app and session:
> app = web.application(urls, globals()).wsgifunc()
> store = web.session.DBStore(db, 'sessions')
> session = web.session.Session(app, store, initializer={'count': 0})

You should pass web.application instance to Session, not wsgi function. Try
changing your code to this:

webapp = web.application(urls, globals())


store = web.session.DBStore(db, 'sessions')

session = web.session.Session(webapp, store, initializer={'count': 0})
app = webapp.wsgifunc()

mengu

unread,
Dec 25, 2009, 3:10:01 AM12/25/09
to web.py
Anand,

thank you for the quick response. that worked very well. :)

mengu

unread,
Dec 25, 2009, 3:28:05 AM12/25/09
to web.py
i actually have another problem.

i keep my files seperate from app.py and import them in the app.py.

when i set session.user = user in users.py signin class, i cannot
access session.user in app.py index class. why is that?

thanks again.

Anand Chitipothu

unread,
Dec 25, 2009, 4:28:52 AM12/25/09
to we...@googlegroups.com
On Fri, Dec 25, 2009 at 1:58 PM, mengu <whal...@gmail.com> wrote:
> i actually have another problem.
>
> i keep my files seperate from app.py and import them in the app.py.
>
> when i set session.user = user in users.py signin class, i cannot
> access session.user in app.py index class. why is that?

try setting web.config.debug = False

mengu

unread,
Dec 25, 2009, 4:57:02 AM12/25/09
to web.py
Anand,

thank you. it is working as expected now. :)

On Dec 25, 11:28 am, Anand Chitipothu <anandol...@gmail.com> wrote:

jlist9

unread,
Dec 25, 2009, 12:10:33 PM12/25/09
to we...@googlegroups.com
Just ran into the same problem yesterday but found a solution in the
cookbook to use sessions in debug mode:
http://webpy.org/cookbook/session_with_reloader

> --
>
> You received this message because you are subscribed to the Google Groups "web.py" group.
> To post to this group, send email to we...@googlegroups.com.
> To unsubscribe from this group, send email to webpy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
>
>
>

mengu

unread,
Dec 26, 2009, 3:44:14 AM12/26/09
to web.py
yes, setting debug to False worked. thanks again. :)
Reply all
Reply to author
Forward
0 new messages