Hi

Thanks for the replies.

The typos (indentation and quote) were introduced as a result of
preparing the code exerpt for this group posting (oops). The
path.append was only temporary and was used for debugging purposes
only.

The solution and the crux of the problem was as follows:

> Change this:
> wsgi_app = SessionMiddleware(application, session_opts)
>
> To:
> application = SessionMiddleware(application, session_opts)

Now, this does seem intuitive since a wrapper is provided by
SessionMiddleware(...). On the other hand, the documentation at beaker
(and elsewhere) re wsgi support seems a little misleading, in that,
the example shows something roughly like the following:

###
def simple_app(...):
    ....
    ....

wsgi_app = SessionMiddleware(simple_app,...)
###

Perhaps, this can be explained by the fact that mod_wsgi is at a
different abstraction layer?

Again, thank you for the support

Regards,

Randy



On Jan 5, 2:53 am, Clodoaldo Neto <[email protected]> wrote:
> 2010/1/5 Clodoaldo Neto <[email protected]>:
>
>
>
>
>
> > 2010/1/4 rnarozniak <[email protected]>:
> >> Hello,
>
> >> I am very new to mod_wsgi, and I am trying to get beaker session
> >> management to work with a mod_wsgi, embedded apache application. I
> >> have a feeling that I am missing something quite fundamental to
> >> mod_wsgi.
>
> >> Any help would be greatly appreciated.
>
> > Just made a copy and paste of your code.
>
> >> in my wsgi application script, i have the following:
>
> >> ##################################################################
> >> from beaker.middleware import SessionMiddleware
>
> >> def application(environ, start_response):
>
> >>    response_headers =  [
> >>        ('Content-Type', 'text/html'),
> >>    ]
>
> >>   session = environ['beaker.session']
>
> > The above line is unaligned. It starts with two spaces only.
>
> >>    sys.path.append("/home/rnarozniak/webapps/mod_wsgi/htdocs")
> >>    import forms
>
> >>    start_response('200 OK', response_headers)
>
> >>    return['test'']
>
> > Two closing quotes.
>
> > Use a syntax coloring editor and you will catch the most common
> > problems. I like Komodo Edit. Not an IDE, just a powerful editor.
>
> > I didn't pay attention to anything else. Will have time later in the day.
>
> Add this line:
>
> import sys
>
> Change this:
> wsgi_app = SessionMiddleware(application, session_opts)
>
> To:
> application = SessionMiddleware(application, session_opts)
>
> Now you have a path problem here:
>
>    sys.path.append("/home/rnarozniak/webapps/mod_wsgi/htdocs")
>    import forms
>
> I would place these two lines at the top of the script out of the
> application function. It will not solve the problem, just a small
> performance and style improvement. There are some threads about path
> problems. Search and you will find then.
>
>
>
>
>
> > Regards, Clodoaldo
>
> >> session_opts = {
> >>    'session.type': 'file',
> >>    'session.cookie_expires': 300
> >> }
> >> wsgi_app = SessionMiddleware(application, session_opts)
>
> >> #################################################################
>
> >> it is failing  on the line: session=environ['breaker.session']
>
> >> breaker does not exist in environ, why?
>
> >> --- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.


Reply via email to