Session CGI!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Session CGI!

    I need a web app framework in python with support for session
    management (ala ASP/PHP). However, unlike some modules I found, I need
    to integrate with an existing Apache install without opening any new
    application server ports (not my server). Is there such a module which
    I can just toss it into pythonpath and get to work?
  • simo

    #2
    Re: Session CGI!

    johng2001@redif fmail.com (John) wrote in message news:<ba129ce7. 0402211010.2313 75d7@posting.go ogle.com>...[color=blue]
    > I need a web app framework in python with support for session
    > management (ala ASP/PHP). However, unlike some modules I found, I need
    > to integrate with an existing Apache install without opening any new
    > application server ports (not my server). Is there such a module which
    > I can just toss it into pythonpath and get to work?[/color]

    You could use cookies and/or database writes. Never been a big fan of
    PHP sessions myself - they are basically temp files and GET variables
    after all....

    Comment

    • John

      #3
      Re: Session CGI!

      > You could use cookies and/or database writes.

      Sadly that is what I want to avoid :-(

      Comment

      • Tim Roberts

        #4
        Re: Session CGI!

        johng2001@redif fmail.com (John) wrote:
        [color=blue][color=green]
        >> You could use cookies and/or database writes.[/color]
        >
        >Sadly that is what I want to avoid :-([/color]

        Well, there isn't any magic avaiable, even in Python. Either you use a
        port and an appserver or you store your session data somewhere. I'm not
        sure what you were hoping to find.
        --
        - Tim Roberts, timr@probo.com
        Providenza & Boekelheide, Inc.

        Comment

        • Erno Kuusela

          #5
          Re: Session CGI!

          johng2001@redif fmail.com (John) writes:
          [color=blue][color=green]
          > > You could use cookies and/or database writes.[/color]
          >
          > Sadly that is what I want to avoid :-([/color]

          see here: http://www.catdancers.com/webmags/webtech/1998/03/perl/

          it's about perl, but you can apply the idea to python too.

          -- erno

          Comment

          • John

            #6
            Re: Session CGI!

            Tim Roberts <timr@probo.com > wrote in message news:<crvl30dj3 mduqo8rbl1qqgij 7mj9r87tng@4ax. com>...[color=blue]
            > johng2001@redif fmail.com (John) wrote:
            >[color=green][color=darkred]
            > >> You could use cookies and/or database writes.[/color]
            > >
            > >Sadly that is what I want to avoid :-([/color]
            >
            > Well, there isn't any magic avaiable, even in Python. Either you use a
            > port and an appserver or you store your session data somewhere. I'm not
            > sure what you were hoping to find.[/color]


            I am not looking for magic. What I am looking for is an elegant
            solution to manage session info like in ASP/PHP, both of which have
            doing this for quite a while. It's hardly exotic. It has been a couple
            of years since I last used ASP, but I think it was session("var") =
            value in ASP. Can't be simpler than that. Similar stuff in PHP
            session_registe r. It manages Client side Cookies under the hood. Nicer
            if the session info is maintained as server side cookies with a unique
            SessionID. At this point, I do not know if that can be done. Sessions
            are important for me since the site is membership based.

            All these nice and comprehensive Python web app framewoks I looked at
            so far DO have session support but need additional ports to be open or
            act their own servers. That's OK if you have your own machine for
            server but my admin will think twice before he installs one of those
            for my non-critical app. PHP does not seem to need that. But I prefer
            Python if I can help it.

            If I don't find quick 'n' easy session management, maybe I will at
            least figure out common web app design patterns with cookies.

            Comment

            • DH

              #7
              Re: Session CGI!

              John wrote:
              [color=blue]
              > I am not looking for magic. What I am looking for is an elegant
              > solution to manage session info like in ASP/PHP, both of which have
              > doing this for quite a while. It's hardly exotic. It has been a couple
              > of years since I last used ASP, but I think it was session("var") =
              > value in ASP. Can't be simpler than that. Similar stuff in PHP
              > session_registe r. It manages Client side Cookies under the hood. Nicer
              > if the session info is maintained as server side cookies with a unique
              > SessionID. At this point, I do not know if that can be done. Sessions
              > are important for me since the site is membership based.
              >
              > All these nice and comprehensive Python web app framewoks I looked at
              > so far DO have session support but need additional ports to be open or
              > act their own servers.[/color]


              You want session cookies stored as temp files instead of in a database.

              To do it with Quixote see the session persistence section here and the
              session_demo.cg i file included with Quixote:


              Spyce is a little more like ASP & PHP, see this doc, esp. the auto-
              session handling part, which can work with or without cookies:

              Comment

              • Harry George

                #8
                Re: Session CGI!

                Erno Kuusela <erno-news@erno.iki.f i> writes:
                [color=blue]
                > johng2001@redif fmail.com (John) writes:
                >[color=green][color=darkred]
                > > > You could use cookies and/or database writes.[/color]
                > >
                > > Sadly that is what I want to avoid :-([/color]
                >
                > see here: http://www.catdancers.com/webmags/webtech/1998/03/perl/
                >
                > it's about perl, but you can apply the idea to python too.
                >
                > -- erno[/color]


                There are two problems:

                1. Where to store state. Databases, cookies, and pickle files are
                available. I've used pickle files for low volume apps.

                2. How to structure the CGI code. Of course, something like webware
                or twisted would hide it all, but let's assume you are writing from
                scratch. Since this is a stateless protocol, we can borrow from
                another (and solved) stateless protocol -- sockets.

                So for each webpage,we make 2 functions (or methods): send_xyz and
                recv_xyz. On wakeup,we check a hidden field to determine which
                "xyz" is arriving, and call its recv. There we use another hidden
                field (or an SSL tag) to get the right database or pickle data and
                load it into an object. Continue processing as if there was no
                time gap. At end (ready for more user input), call the proper
                "send". It prepares the hidden fields, saves the state, and prints
                the outgoing page. The script exits and we are back at the
                browser.

                --
                harry.g.george@ boeing.com
                6-6M21 BCA CompArch Design Engineering
                Phone: (425) 342-0007

                Comment

                • John

                  #9
                  Re: Session CGI!

                  DH <no@sp.am> wrote in message news:<ufOdnUCfS sA0EKbd4p2dnA@c omcast.com>...[color=blue]
                  > You want session cookies stored as temp files instead of in a database.
                  >
                  > To do it with Quixote see the session persistence section here and the
                  > session_demo.cg i file included with Quixote:
                  > http://www.mems-exchange.org/softwar...sion-mgmt.html
                  >
                  > Spyce is a little more like ASP & PHP, see this doc, esp. the auto-
                  > session handling part, which can work with or without cookies:
                  > http://spyce.sourceforge.net/doc-mod_session.html[/color]

                  Hi DH,
                  I am looking at Quixote and Spyce. Both are very nice and fit my needs.

                  Thanks,
                  John.

                  Comment

                  Working...