You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by Apache Wiki <wi...@apache.org> on 2007/03/27 01:50:45 UTC

[Mod_python Wiki] Update of "Session use with classes" by RoyFielding

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Mod_python Wiki" for change notification.

The following page has been changed by RoyFielding:
http://wiki.apache.org/mod_python/Session_use_with_classes

------------------------------------------------------------------------------
  ----
  [[Anchor(ExampleStackedHandler)]]
  ==== 1. Using the Stacked Handler ====
- Your nominal URL for this example will be
+ Your nominal URL for this example will be 
  {{{
  http://your.domain.com/ExampleSession/ExampleStackedHandler.py/foo
  }}}
@@ -35, +35 @@

      PythonHandler mod_python.publisher
  </Directory>
  }}}
- Notice there are two '''Python``Handler''' entries here. When invoked, Apache will call these in order. The first calls a file ''_sessions.py''.
+ Notice there are two '''Python``Handler''' entries here. When invoked, Apache will call these in order. The first calls a file ''_sessions.py''. 
  
  {{{#!python
  # Save this file as _sessions.py
@@ -94, +94 @@

  
  [[Anchor(ExampleInstance)]]
  ==== 2. Using a class Instance ====
- Your nominal URL for this example will be
+ Your nominal URL for this example will be 
  {{{
  http://your.domain.com/ExampleSession/ExampleInstanceSession.py/foo
  }}}
@@ -157, +157 @@

  As you see, we are not instantiating the '''Example``Session''' class directly, but using the '''Instance''' class to create a new Example``Session object each time a call is made to the request handler. This avoids the possibility of gumming up the works in Apache if concurrent worker threads are all executing the same handler.
    Advantages:: (./) This allows you to have a mixture of non-session and session enabled funxtions/classes in a single package. Those not needing a session context are not required to implement this solution.
    :: (./) You have access to the ''req'' object before your working class is called. This allows you to initialize it with info from the request Form``Object (if available).
- 
+  
    Disadvantages:: (./) The Instance class is duplicated in all modules. If you have a large python package, this is an inefficient manner to implement Sessions.
  
  Note that in both of these prior examples, the '''Example``Session''' class remained the same.
@@ -168, +168 @@

  ==== 3. Using a class to invoke functions ====
  
  This last example is a bit of an odd-ball, we see how to use a class to invoke a selection of methods defined in the same module. This is not common practice, but maybe it will give you some ideas.
- Your nominal URLs for this example will be
+ Your nominal URLs for this example will be 
  {{{
  http://your.domain.com/ExampleSession/ExampleFunctionSession.py/foo
  http://your.domain.com/ExampleSession/ExampleFunctionSession.py/bar
@@ -219, +219 @@

  }}}
  
  This should give you a working starting point. From here the sky is the limit!
- ----
+ ---- 
  CategoryExamples CategoryExamples
-  [http://precinct.100freemb.com/96.html lesbian celebrity pictures] | [http://wingspan.9cy.com/38.html vietnamese wives] | [http://diktats.00freehost.com/54.html porn web cam] | [http://arboreal.angelcities.com/1.html fuck pregnant women] | [http://homepage.mac.com/contemn/27.html playmate webcam nude] | [http://tintypes.bravepages.com/30.html pussy vibrator girls] | [http://yeshivoth.150m.com/15.html small asian girls] | [http://unbars.freecities.com/83.html free gay videos] | [http://yap.freecities.com/40.html nacked women] | [http://vacillates.wtcsites.com/59.html female anal fist] | [http://homepage.mac.com/wardroom/90.html gallery of dicks] | [http://masturbate.fcpages.com/35.html group sex art] | [http://vacillates.wtcsites.com/11.html dvd piss slut] | [http://utterly.bravepages.com/68.html real college girls] | [http://homepage.mac.com/whereon/88.html fisting pussies] | [http://homepage.mac.com/cruelly/21.html webcam nude girls] | [http://homepage.mac.com/succeed2/77
 .html hot bisexual girls] | [http://represses.envy.nu/20.html vagina massage] | [http://zircons.741.com/49.html knicker wet] | [http://homepage.mac.com/seawards/33.html girl dancing webcam] | [http://amusingly.angelcities.com/68.html suburban housewives playboy] | [http://zeroed.9cy.com/65.html free black butt] | [http://leviers.ibnsites.com/49.html webcam model train] | [http://tunisia.00freehost.com/60.html lactating in bondage] | [http://treatments.dreamstation.com/15.html bbw women] | [http://homepage.mac.com/platoon1/61.html boy webcams] | [http://bullwhip.dreamstation.com/25.html exhibitionist webcam] | [http://thanedom.1accesshost.com/54.html wet boys] | [http://homepage.mac.com/ammeter/45.html sex webcams] | [http://deviations.dreamstation.com/63.html plump intercourse]