Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Separating design from code

Reply
Thread Tools

Separating design from code

 
 
Νικόλαος Κούρας
Guest
Posts: n/a
 
      03-22-2011
Hello, in this page http://www.superhost.gr/hosting.html at the bottom
end i decided to create a textarea for the user to enter some comments
related to the page that i want to submit to a mysql database table.

Now i have seperated the design from the code:

http://www.superhost.gr/hosting.html is the design
http://www.superhost.gr/cgi-bin/counter.py is the python script

Every request to any html page due to mod rewrite is passed to the
above python script.

Its my first time tryign to do this so i need to ask:

a) When the user hits submit after entering comments in the
hosting.html

<form method="post" action="http://superhost.gr/cgi-bin/counter.py">
<textarea name="comments" cols="40" rows="5">
Σχολιάστε ή ρωτήστε με σχετικά....
</textarea><br>
<input type="submit" value="Ρωτήστε" />
</form>

What should the action be? The file itself or to the python code
script
As i have it now i am getting an error
Just try to enter something and hit sumbit you will see an error page.

#relevant counter.py code
# get some enviromental values
form = cgi.FieldStorage()
page = form.getvalue('page')

# try to open the page
f = open( '../' + page )

Why when the user submits the form error is created?

I need help passing an html form to my python script.

Please ask me if i need to provide more information about anything.

the mod rewrite rule is:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?page=$1 [L,PT,QSA]

so for every html request to be handled by counter.py script
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separating html from code Manuel ASP .Net 2 11-29-2004 09:21 PM
Separating directory from file name: Code Review! Joe Laughlin C Programming 17 06-13-2004 11:31 PM
Design Issue: Separating Application Security Model from the Application (Custom or User) Controls Earl Teigrob ASP .Net 3 06-10-2004 01:56 AM
Separating code from design Chad Z. Hower aka Kudzu ASP .Net 6 01-24-2004 04:51 PM
Separating design from code - help a Perl monger - java noob lord0 Java 6 12-20-2003 08:54 PM



Advertisments