[Zope] add instance of ZClass as authenticated user

John Hunter jdhunter@ace.bsd.uchicago.edu
Mon, 29 Apr 2002 10:27:45 -0500


I have a Product called Course which contains a ZClass called
ProjectSubmission (which resides in /Control_Panel/Products/Course).  I
want authenticated users to be able to add ProectSubmission instances.

I have a web form that calls ProjectSubmission_add_py:

REQUEST = container.REQUEST
RESPONSE =  REQUEST.RESPONSE


pid = REQUEST.get('project_id')
submission = context.ProjectSubmission.createInObjectManager(pid, REQUEST)
submission.manage_addFile(id='',file=file_data)
submission.manage_addFolder(id='Comments')
submission.Comments.manage_addProperty('next_id', 0, 'int')


propSheet = submission.propertysheets.ProjectSubmissionPropertySheet
propSheet.manage_changeProperties(REQUEST)
propSheet.manage_changeProperties(file_name=file_data.filename)
propSheet.manage_changeProperties(submission_date=DateTime())

REQUEST.RESPONSE.redirect(submission.absolute_url())

This works fine if the user has manager/owner permissions at root
level, but I want it to work for a user that is simply authenticated
at the container level.  If I try and execute the script simply as an
authenticated user at container level, I get the error:

  Error Type: AttributeError
  Error Value: ProjectSubmission

Could someone advise me on how I should can change the script and/or
the ProjectSubmission and Course properties and security settings so
that authenticated users can add PrjectSubmissions 

Thanks,
John Hunter