Return-Path: Delivered-To: apmail-httpd-python-cvs-archive@www.apache.org Received: (qmail 5383 invoked from network); 26 Mar 2007 23:51:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2007 23:51:06 -0000 Received: (qmail 23892 invoked by uid 500); 26 Mar 2007 23:51:14 -0000 Delivered-To: apmail-httpd-python-cvs-archive@httpd.apache.org Received: (qmail 23865 invoked by uid 500); 26 Mar 2007 23:51:14 -0000 Mailing-List: contact python-cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: python-dev@httpd.apache.org Delivered-To: mailing list python-cvs@httpd.apache.org Received: (qmail 23854 invoked by uid 99); 26 Mar 2007 23:51:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 16:51:14 -0700 X-ASF-Spam-Status: No, hits=-93.1 required=10.0 tests=ALL_TRUSTED,URIBL_AB_SURBL,URIBL_SC_SURBL X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 16:51:05 -0700 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id CF09959F71 for ; Mon, 26 Mar 2007 23:50:45 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: python-cvs@httpd.apache.org Date: Mon, 26 Mar 2007 23:50:45 -0000 Message-ID: <20070326235045.6909.26484@eos.apache.org> Subject: [Mod_python Wiki] Update of "Session use with classes" by RoyFielding X-Virus-Checked: Checked by ClamAV on apache.org 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 }}} - 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]