blondelle@abes.fr wrote at 2008-12-8 11:43 +0100:
... Few months ago, I send my problem with attach file with Zope 2.6 and higher. How I have no solution, I send again my problem which is described after --------
Thanks to help me
Frederique
---------------
I have created a zclass with zfile as basic class. With this class, users could, via a web form, send an attached file if they want. With zope 2.5 (my previous version) if users don't attach a file, there is no problem with zope 2.10, if there is no file attached, I have an error message : 'file not specified". It seems that attach file is mandatory.
Here, the complete message from the events log :
Traceback (innermost last): ... Module ZClasses.ZClass, line 454, in createInObjectManager Module ZClasses.ZClass, line 485, in fromRequest Module ZPublisher.mapply, line 89, in mapply Module OFS.Image, line 120, in __init__ Module OFS.Image, line 501, in _read_data ValueError: File not specified
I cannot tell you what changed since Zope 2.5 (this is far too long ago). I can tell you why you get the exception above in modern Zope versions: A modern Zope version insists that if the "file" parameter to "OFS.Image.File.__init__" is a "FileUpload" object, then it must have a non empty filename. You may be able to use this in your "Quest_susvp_add" method as follows: You check whether the uploaded file is "False" (this means "empty filename") and in this case replace it in "REQUEST.form" with an empty string. Not sure that it will work, though. -- Dieter