LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-28-2008, 07:49 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
mod_python - is there an equivalent to $_SERVER['PHP_SELF'] in mod_python?


I'm making a mod_python/PSP page. That page lives in two places, a dev spot and a live spot. It includes a custom module that is also either dev or live. I want the dev version to include the dev module & the live version to include the live module.

in PHP, I check to see what $_SERVER['PHP_SELF'] is to determine which file to include. Is there a way to do that in mod_python?

if it matters, I want to do something like:
Code:
import sys,string
if string.find($_SERVER['PHP_SELF'],"dev") >= 0: # obviously, that doesn't work
  sys.path.append("/dev/module/path")
else:
  sys.path.append("/live/module/path")
import module
... but am open to suggestions.
 
Old 04-28-2008, 07:57 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
So I spent the last 2 hours searching for this answer, and of course, as soon as I post it here, I find the answer.

req.uri holds the uri.

Is there a list of all things in req? It's probably in the manual, I just haven't found it yet.
 
Old 04-28-2008, 09:46 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by BrianK View Post
It's probably in the manual, I just haven't found it yet.
yup: 4.5.4 Request Object
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't configure mod_python carlwenrich Linux - Server 4 03-16-2009 07:36 PM
apache/mod_python problem: ImportError: No module named mod_python.apache BrianK Linux - Software 2 10-10-2007 05:13 PM
mod_python error blong4life Linux - Software 0 06-26-2007 11:15 AM
need help with mod_python tiang_ono Linux - Newbie 2 06-20-2005 08:12 PM
mod_python gaddargarson Programming 1 03-29-2005 08:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration