[Seaside] Re: Magritte + Comet problem?

John Chludzinski john.chludzinski at gmail.com
Fri Jun 5 14:57:41 UTC 2009


Will a change-set do?  ---John

On Wed, Jun 3, 2009 at 6:33 PM, John
Chludzinski<john.chludzinski at gmail.com> wrote:
> The problem occurred when I tried to use MAFileDescription from
> Magritte.  When I tried to 'upload' a file I had selected, I got an
> error in my Opera browser.  After some investigation I found that the
> 'fields' instance variable in WARequest was an empty Dictionary.
> Hence, the changes in the class WAListener.  ---John
>
>
> On Wed, Jun 3, 2009 at 3:18 PM, John Chludzinski
> <john.chludzinski at gmail.com> wrote:
>> To use Comet I use:
>>
>>      WAListener startOn: 8080.
>>
>> But it appears that Magritte doesn't work with WAListener.  To get it
>> to work Bob Arning & I made mods to WAListener (let me know anyone if
>> this is problematic?):
>>
>> !WAListener methodsFor: 'private' stamp: 'raa 6/3/2009 14:42'!
>> convertFileName: aString
>>        ^aString! !
>>
>> !WAListener methodsFor: 'private' stamp: 'raa 6/3/2009 14:42'!
>> convertRequest: aKomRequest
>>        | request |
>>
>>        self processMultipartFields: aKomRequest.
>>
>>        request := WARequest
>>                method: aKomRequest method
>>                url: aKomRequest url unescapePercents
>>                headers: aKomRequest header
>>                fields: (self fieldsOf: aKomRequest)
>>                cookies: aKomRequest cookies
>>                nativeRequest: aKomRequest.
>>
>>        aKomRequest method = 'PUT'
>>                ifTrue: [request fields
>>                                        at: 'PUTData'
>>                                        put: (aKomRequest stream next: aKomRequest contentLength)].
>>        ^ request! !
>>
>> !WAListener methodsFor: 'as yet unclassified' stamp: 'raa 6/3/2009 14:42'!
>> convertMultipartFileField: aChunk
>>
>>        ^(WAFile fromChunk: aChunk)
>>                fileName: (self convertFileName: aChunk fileName);
>>                contentType: aChunk contentType
>>                yourself! !
>>
>> !WAListener methodsFor: 'as yet unclassified' stamp: 'raa 6/3/2009 14:42'!
>> processMultipartFields: aRequest
>>
>>        aRequest multipartFormFieldsDo: [ :chunk |
>>                | contents fieldName previousValue |
>>                fieldName := chunk fieldName.
>>                contents := chunk fileName isEmptyOrNil
>>                        ifTrue: [
>>                                String streamContents: [ :stream |
>>                                        chunk saveToStream: stream ] ]
>>                        ifFalse: [ self convertMultipartFileField: chunk ].
>>                previousValue := aRequest postFields at: fieldName ifAbsent: [ nil ].
>>                previousValue isNil
>>                        ifTrue: [  aRequest postFields at: fieldName put: contents ]
>>                        ifFalse: [
>>                                (previousValue isKindOf: self collectionClass)
>>                                        ifTrue: [ previousValue add: contents ]
>>                                        ifFalse: [ aRequest postFields at: fieldName put: (self
>> collectionClass with: previousValue with: contents) ] ] ]! !
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Listener-Magritte fix.1.cs.gz
Type: application/x-gzip
Size: 762 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090605/85abc6ab/Listener-Magrittefix.1.cs.bin


More information about the seaside mailing list