Re: [Twisted-Python] Question regarding widgets

---------- Original Message ---------------------------------- From: Andrew Bennetts <andrew-twisted@puzzling.org> Reply-To: twisted-python@twistedmatrix.com Date: Wed, 6 Nov 2002 12:12:12 +1100
Ummm so does that mean I have to add something to the pythonpath for a web application that I am building in a particular directory ?
_____________________________________________________________________ iRepublics.com - Free Web Hosting for Businesses 33MB webspace free, SMS messaging, 30 email accounts, your own domain name Sign up Now at http://www.iRepublics.com

On Wed, Nov 06, 2002 at 09:12:52AM +0800, lals;dfjsd wrote:
Ummm so does that mean I have to add something to the pythonpath for a web application that I am building in a particular directory ?
Unfortunately, I don't know -- I'm not a Twisted Web expert. :( Someone else will have to answer this one. -Andrew.

At 09:12 AM 11/6/2002 +0800, lals;dfjsd wrote:
Ummm so does that mean I have to add something to the pythonpath for a web application that I am building in a particular directory ?
I think I know what Mr. Dfjsd is getting at; I hit this same problem. If you're building an app in c:\webapp, and you run twistd from that directory, then 'c:\webapp' should be part of sys.path. The reason for this is that '.' is part of sys.path, and if you're running twistd in c:\webapp, then '.' == 'c:\webapp'. So, if: c:\webapp\docroot contains your HTML files and RPY files c:\webapp\my_app contains any Python code you need to import ...and you run: c:\webapp> mktap web --path docroot c:\webapp> twistd -f web.tap ...if you have a .rpy in c:\webapp\docroot, it can call 'import my_app' and it should work fine. (Provided c:\webapp\my_app\__init__.py exists.) Does that answer your question? (All twisted.web.woven gurus: feel free to comment or correct me. :) -- Alex Levy WWW: http://mesozoic.geecs.org Tel: 617.835.0778 "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_

On Wed, 06 Nov 2002, Steve Waterbury <waterbug@beeblebrox.gsfc.nasa.gov> wrote:
What if you run a Python program from /tmp? One of those smart programs which do something like ''' try: import gtk except ImportError: gtk = None ''' What if some malicious user put a gtk.py in /tmp which does something like ''' open(os.path.expanduser("~/.secret")) os.chmod(os.path.expanduser("~/.secret"), 0777) ''' And to top it all, assume gtk is, indeed, not installed on this system.

Moshe Zadka wrote:
Perhaps I am protected by a higher level of general paranoia: I would never run anything from /tmp (or any other directory where just anyone could write something into, but especially not from /tmp!). I only run Python scripts either from inside my home dir (for which I leave the RH default perms, drwx------) or from a root-writable-only dir such as /usr/local/... (if somebody's hacked root, I've got bigger problems anyway!). Of course, the conversation started with Windows, and I have no idea what the implications are there ... probably much more dire, like everything else on Windows. ;^) Cheers, -- Steve.

On Wed, Nov 06, 2002 at 09:12:52AM +0800, lals;dfjsd wrote:
Ummm so does that mean I have to add something to the pythonpath for a web application that I am building in a particular directory ?
Unfortunately, I don't know -- I'm not a Twisted Web expert. :( Someone else will have to answer this one. -Andrew.

At 09:12 AM 11/6/2002 +0800, lals;dfjsd wrote:
Ummm so does that mean I have to add something to the pythonpath for a web application that I am building in a particular directory ?
I think I know what Mr. Dfjsd is getting at; I hit this same problem. If you're building an app in c:\webapp, and you run twistd from that directory, then 'c:\webapp' should be part of sys.path. The reason for this is that '.' is part of sys.path, and if you're running twistd in c:\webapp, then '.' == 'c:\webapp'. So, if: c:\webapp\docroot contains your HTML files and RPY files c:\webapp\my_app contains any Python code you need to import ...and you run: c:\webapp> mktap web --path docroot c:\webapp> twistd -f web.tap ...if you have a .rpy in c:\webapp\docroot, it can call 'import my_app' and it should work fine. (Provided c:\webapp\my_app\__init__.py exists.) Does that answer your question? (All twisted.web.woven gurus: feel free to comment or correct me. :) -- Alex Levy WWW: http://mesozoic.geecs.org Tel: 617.835.0778 "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_

On Wed, 06 Nov 2002, Steve Waterbury <waterbug@beeblebrox.gsfc.nasa.gov> wrote:
What if you run a Python program from /tmp? One of those smart programs which do something like ''' try: import gtk except ImportError: gtk = None ''' What if some malicious user put a gtk.py in /tmp which does something like ''' open(os.path.expanduser("~/.secret")) os.chmod(os.path.expanduser("~/.secret"), 0777) ''' And to top it all, assume gtk is, indeed, not installed on this system.

Moshe Zadka wrote:
Perhaps I am protected by a higher level of general paranoia: I would never run anything from /tmp (or any other directory where just anyone could write something into, but especially not from /tmp!). I only run Python scripts either from inside my home dir (for which I leave the RH default perms, drwx------) or from a root-writable-only dir such as /usr/local/... (if somebody's hacked root, I've got bigger problems anyway!). Of course, the conversation started with Windows, and I have no idea what the implications are there ... probably much more dire, like everything else on Windows. ;^) Cheers, -- Steve.
participants (5)
-
Alex
-
Andrew Bennetts
-
lals;dfjsd
-
Moshe Zadka
-
Steve Waterbury