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(
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/', '' )
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
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
Τη Τρίτη, 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:
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') ==
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:
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,
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