[ZDP] default location for writing files
Adrian Graham
aag@stanford.edu
Wed, 23 Jun 1999 01:17:47 +0200
I am currently working through "A Technical Introduction to Object
Publishing with Zope" and unfortunately am having problems with the
example code for saving visitors' comments to a text file (I've included
the example code below). It isn't clear to me is where the file
"feedback_data" is being written if no explicit path is given (It
doesn't appear to be the same directory as the Python code). Since I do
not know where this file is located (or will be located) I don't know
where I should set the permissions to give write access to the Zope user
-- therefore the program doesn't work.
Any clarifications would be greatly appreciated.
Much thanks,
Adrian Graham
"""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)
file.close()
return "Thank you for your feedback!"