Finally got my hands on The Quick Python book and have read the first 13
chapters. I've now jumped to chapter 26, "Using Zope", to try out some
of the examples there. I'm havng a problem with the feedback form
example (p326) and I'd be really grateful if someone could point out
what I am doing wrong.

- I created a directory in the root called 'feedback' and to this I
added a DTML document, 'index_html'. I see no probs with this but maybe
someone could confirm that the post action is correct for me.

<dtml-var standard_html_header>
<FORM ACTION="/cgi-bin/feedback/save_feedback" METHOD="POST">
Type of feedback:
<SELECT NAME="feedback_type">
Your comments:
<INPUT TYPE="SUBMIT" VALUE="Submit Feedback">
<dtml-var standard_html_footer>

- I then create a python method called 'feedback.py' containing the

"""feedback.py: A simple feedback form application"""
def save_feedback(feedback_type, comments):
    """ A function to handle submitted feedback form data"""
    # Open a file for appending to save the feedback
    # creating the file if necessary
    try: file=open("feedback_data", "a")
    except IOError:
        file=open("feedback_data", "w")
    # Save the data
    file.write("Feedback type: %s\n" % feedback_type)
    file.write("Comments: %s\n\n % comments)
    return "Thankyou for your feedback!"

^ On the Python method addition screen I use feedback(.py) as the ID +
title and insert "feedback_type, comments" in the parameter list. Of
course, this results in an error SyntaxError & Invalid token.

I tried to modify it by taking out the first 2 lines of the above code,
renaming the method 'save_feedback' but still no success. I'm unsure
whether the return statement will do anything in Zope also.

Can anyone help?

- Best regards,

Lee (with 10 crossed fingers & toes)

Lee Reilly

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to