[Zope] Re: manage_addFile problem

Ian Sealy Ian.Sealy@bristol.ac.uk
Thu, 4 Jan 2001 14:55:47 +0000 (GMT)


Dear all,

I sent the following message to the list just before Christmas, but
didn't get any replies. I've tried changing the admin_addfiles method
to:

  <dtml-call expr="manage_addFile(filename, file='', title=filetitle)">
  <dtml-let newfile="_.getitem(filename)">
  <dtml-call expr="newfile.manage_upload(file)">
  <dtml-call expr="newfile.manage_addProperty('author', fileauthor, 'string')">
  <dtml-call expr="newfile.manage_addProperty('maintainer', filemaintainer, 'string')">
  <dtml-call expr="newfile.manage_addProperty('description', filedescription, 'string')">

but I still get the same error. Has anyone got any advice? I can't see
how this is different from adding a file using the management screens.

> I've got a really simple little Zope application that allows staff here
> to upload documents into a folder of their choice without seeing the
> Zope management screens. There's a form that looks like this:
> 
>   <form action="admin_addfiles" method="POST" enctype="multipart/form-data">
>   <input type="file" name="file" size="40">
> etc...
> 
> The admin_addfiles method then actually creates the file and applies
> some properties to it (that also come from the form):
> 
>   <dtml-call expr="manage_addFile(filename, file=file, title=filetitle)">
>   <dtml-let newfile="_.getitem(filename)">
>   <dtml-call expr="newfile.manage_addProperty('author', fileauthor, 'string')">
>   <dtml-call expr="newfile.manage_addProperty('maintainer', filemaintainer, 'string')">
>   <dtml-call expr="newfile.manage_addProperty('description', filedescription, 'string')">
>   </dtml-let>
> 
> It all works fine until I try to upload a file that's greater than about
> 128 kb. When I try that I get the following error:
> 
> Error Type: AttributeError
> Error Value: abort_sub
> 
> Traceback (innermost last):
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 222, in publish_module
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
>   File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
>     (Object: Traversable)
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 175, in publish
>   File /usr/local/zope/lib/python/Zope/__init__.py, line 235, in commit
>   File /usr/local/zope/lib/python/ZODB/Transaction.py, line 290, in commit
> AttributeError: (see above)
> 
> I don't see this if I add a similar-sized file using the Zope management
> screens. Anyone done anything similar and seen this?

Cheers,
Ian