[Zope] rename and delete with cookie crumbler

Joshua Newman lazernewman at yahoo.com
Sun Jul 18 01:30:04 EDT 2004


Hi all,

I have a script which allows a user to upload a schedule to a site.

If a file has already been uploaded, the user is kicked into a
script asking if they want to overwrite it.

Weird thing is that the script doesn't work with the cookie crumbler.

Here's the script:

##file uploaded to tempfile to overwrite month_file 
filename=REQUEST.get('month_file')
container.manage_delObjects(ids=filename)
container.manage_renameObject('tempfile', filename )
u = REQUEST.cookies.get('referer', container.absolute_url() )
RESPONSE.redirect(u)

I can delete by itself.  I can rename by itself. (i.e. if I comment
over the other command).  But the two together make me authenticate
over and over until I get an error message that says:

Traceback (innermost last):
  Module ZPublisher.Publish, line 100, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Shared.DC.Scripts.Bindings, line 306, in __call__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 318, in _exec
  Module None, line 10, in overwrite_file_py
   - <PythonScript at /masonicmed/schedules/overwrite_file_py>
   - Line 10
  Module OFS.CopySupport, line 247, in manage_renameObject
  Module OFS.CopySupport, line 385, in _verifyObjectPaste
Unauthorized: <unprintable instance object>

n.b.
The script works perfectly with http authentication on another similar
site that doesn't have cookie crumbler.

I've tried splitting the delete/rename into two scripts called
sequentially and I get the same behavior.

I've tried rename and rename rather than delete and rename.  And I get
the same behavior.

And the reason I'm renaming tempfile is because I want the upload page
to work, cache the file, and then decide if the user wants to overwrite
it.

I'm about to give up and just figure out a new system.  Any help?
Josh





More information about the Zope mailing list