Using Python under ASP

Discussion in 'Python' started by Max Ischenko, Sep 10, 2003.

  1. Max Ischenko

    Max Ischenko Guest

    Hi,

    I'm using Python under ASP env. and have a question about how to
    communicate Python snippets in different pages.

    For example, I'd like to create a per-session object of class FooBar and
    be able to access it from any page. How could I do this?

    I can't store anything complicated in a Session.
    Someone here propose pickle/unpickle an object to the string but that
    feels like a kludge. Should I setup some global hash, keyed by SessionID
    to store data there?


    TIA.

    --
    Regards, Max.
     
    Max Ischenko, Sep 10, 2003
    #1
    1. Advertising

  2. Max Ischenko

    Steve Holden Guest

    "Max Ischenko" <> wrote in message
    news:bjmiej$ihe$...
    >
    > Hi,
    >
    > I'm using Python under ASP env. and have a question about how to
    > communicate Python snippets in different pages.
    >
    > For example, I'd like to create a per-session object of class FooBar and
    > be able to access it from any page. How could I do this?
    >
    > I can't store anything complicated in a Session.


    Why not? Because Microsoft says so? Becuase your employer says so? What's
    "complicated"?

    Initially, MS promoted the Session object as the place to store session
    state. Then they found that uninformed idiots were saving stupid things like
    large ADO resordsets in Session in large numbers, and getting locking and/or
    synchronization problems across multiple sessions. Who would have thought
    that crappy design could have resulted in crappy performance? Also, the
    larger players complained that the mechanism didn't scale across multiple
    servers (because it's host-specific).

    So the conventional advice became "don't store complex objects in Session,
    find some other mechanism". And software vendors and authors made stacks of
    money creating and writing about replacement mechanisms.

    > Someone here propose pickle/unpickle an object to the string but that
    > feels like a kludge. Should I setup some global hash, keyed by SessionID
    > to store data there?
    >


    If you can convince me that this will actually generate any saving then you
    might try it, but personally I'd try saving it in Session and seeing whether
    that worked OK for your application. The advantage of pickling would be that
    you aren't leaving a reference to an object lying around between page
    invocations,.

    One last point: if the reason you "can't save anything complicated in a
    Session" is because your employer's programming standards say so, then a)
    ask them to define "complicated", and b) start dicreetly looking for new
    employment :)

    regards
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/pwp/
     
    Steve Holden, Sep 11, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hshdude
    Replies:
    12
    Views:
    1,110
    Dimitri Maziuk
    Nov 4, 2004
  2. bronby
    Replies:
    1
    Views:
    671
    Andrew Thompson
    Jul 15, 2005
  3. Edward V. Berard
    Replies:
    4
    Views:
    942
    John B. Matthews
    Apr 4, 2006
  4. john san
    Replies:
    19
    Views:
    775
    Diez B. Roggisch
    Feb 18, 2005
  5. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    386
    Luke Kenneth Casson Leighton
    Jan 15, 2009
Loading...

Share This Page