[Seaside-dev] Guard in file upload

Philippe Marschall philippe.marschall at gmail.com
Mon Sep 6 07:15:39 UTC 2010


2010/9/5 Sean P. DeNigris <sean at clipperadams.com>:
>
> In Dynamic Web Development with Seaside - 10.7 File Uploads, the code has the
> following:
> UploadForm>>receiveFile: aFile
>    | file |
>    aFile isNil ifTrue: [ ^ nil ].
> ...
>
> The explanation says:
>
> Note that it is possible to press the Send File button before selecting a
> file. The #receiveFile: method guards against this by checking that file is
> not nil.
>
> However, I put a halt in the block, and hit the "Send file" button, and it
> seems this is never called:
>        aFile isNil ifTrue: [
>                self halt.
>                self inform: 'No file!'].
>
> Is this guard necessary?

Nope you're right, it's not. WAUploadCallback >> #valueForField:
answers nil if there's not file and WAValueCallback >>
#evaluateWithArgument: has the nil guard.

Cheers
Philippe


More information about the seaside-dev mailing list