Re: Receing a form variable as a list instead of as a string

2013-06-12 Thread Steven D'Aprano
On Tue, 11 Jun 2013 18:29:05 -0700, nagia.retsina wrote: if page or form.getvalue('show') == 'log': # it is a python script page = page.replace( '/home/nikos/public_html/cgi-bin', '' ) elif page or form.getvalue('show') == 'stats': page = page.replace(

Receing a form variable as a list instead of as a string

2013-06-11 Thread Νικόλαος Κούρας
page = form.getvalue('page') if form.getvalue('show') == 'log' or page: # it is a python script page = page.replace( '/home/nikos/public_html/cgi-bin/', '' ) elif os.path.exists( page ): # it is an html template page = page.replace( '/home/nikos/public_html/', '' )

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Andreas Perstinger
On 11.06.2013 12:38, Νικόλαος Κούρας wrote: but page is a form variable coming from a previous sumbitted form why the error says 'page' is a list? RTFM: If the submitted form data contains more than one field with the same name, the object retrieved by form[key] is not a FieldStorage or

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Ulrich Eckhardt
Am 11.06.2013 12:38, schrieb Νικόλαος Κούρας: File /home/nikos/public_html/cgi-bin/metrites.py, line 28, in module, referer: http://xxxredactedxxx/ page = page.replace( '/home/nikos/public_html/', '' ), referer: http://xxxredactedxxx/ AttributeError: 'list' object has no attribute

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Νικόλαος Κούρας
Τη Τρίτη, 11 Ιουνίου 2013 2:51:04 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: For that, you'd have to adjust the code that you received it from. If that's not possible, convert it to a string yourself. But didn't you want a form variable? i manages to work around it by using this:

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Νικόλαος Κούρας
But if i write it as: if not page and os.path.exists( file ): # it is an html template page = file.replace( '/home/nikos/public_html/', '' ) elif page or form.getvalue('show') == 'log': # it is a python script page = page elif page or form.getvalue('show') ==

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread alex23
On Jun 12, 5:42 am, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: Indeed as Andreas said i was overusing the form variable 'page' No. You're simply _not_ thinking about what you're doing. elif page or form.getvalue('show'):         # it is a python script         page = page else:        

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread alex23
On Jun 12, 6:16 am, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: I get the error that i cannot use 'replac'e to a 'list'. How can i avoid that? BY NOT USING STRING METHODS ON A LIST. Ulrich even *told* you what to do: convert it to a string yourself Do you do that in your code? No. Instead,

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread nagia . retsina
if page or form.getvalue('show') == 'log': # it is a python script page = page.replace( '/home/nikos/public_html/cgi-bin', '' ) elif page or form.getvalue('show') == 'stats': page = page.replace( '/home/nikos/public_html/cgi-bin', '' ) in the first if option page