Filepath string manipulation help

2005-11-02 Thread mjakowlew
Hi,

I'm trying to use some string manipulation from a file's path.

filepath='c:\documents\web\zope\file.ext'

I need to extract everthing after the last '\' and save it.
I've looked around and have tried the sub, search, match commands, but
I'm guessing '\' is set aside for switches. I need to know how to
search for the '\' in a string. I'm guessing it has something to do
with ASCII char codes.

Thanks in advance for any help,
mjakowlew

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Filepath string manipulation help

2005-11-03 Thread mjakowlew
Thanks guys. The os.path method works, but this is for a script for a
website upload program on a zope webserver. For some reason even admin
access won't let me run the script through the server.

The main issue with my script is that Firefox has no problem with the
program the way it is, but IE somehow uses a different filename format.

ex:/

In IE
filepath='c:\documents\web\zope\file.ext'

In Firefox
filepath='file.ext'

So when IE goes to upload the file, it gets an error for illegal
characters because of the "\"'s and ":" Is there another way to do this
(extract just the filename) using something else other than the "os"
that won't be blocked by the webserver

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Filepath string manipulation help

2005-11-03 Thread mjakowlew
 I got the "IE Fix" working, here's the code:


path = r'c:\here\there\files\file.ext'

i=len(path)
j=0
size=len(path)

while i:
  i=i-1
  if path[i]== '\\':
j=i+1
break

filename = path[j:size]
print "FILENAME: %s" %(filename)
___

Most importantly this works on my Zope webserver.

Thanks again,
mjakowlew

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Filepath string manipulation help

2005-11-04 Thread mjakowlew
Steve,

the os commands don't run through zope, it denies access to them to be
run at all through  the webserver. So in turn, I had to use a work
around to fix the IE problem. Also qwwee's suggestion to use:

 filepath.split('\\')[-1]

works well too. Zope is very finicky about running specific commands,
I'm sure this is due to security issues of running os commands through
a website/webserver.

-- 
http://mail.python.org/mailman/listinfo/python-list


Calling values from a webform to Python

2005-11-11 Thread mjakowlew
hi,

I'm trying to pass some values from a webform into a python script.

___



 Name: 
 Email: 
 


___

Now, how do I call these individual attributes (filename,title, etc.)
in my "processForm.py".
I think it has something to do with the:

REQUEST=context.REQUEST

command, but I'm not quite sure how to implement it properly. Also this
is done through Zope if that makes a difference to anyone.

Thanks in advance,
mjakowlew

-- 
http://mail.python.org/mailman/listinfo/python-list