Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-TheresaHMartenK.261.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-TheresaHMartenK.261
Author: TheresaHMartenK
Time: 20 June 2020, 4:04:09.471561 pm
UUID: ec0bd065-4cc8-7d48-b940-4bf5a0f4a7cf
Ancestors: ToolBuilder-Morphic-mt.260
The current implementation searches for the supplied answer in the valueList and if found returns the value at the found index in the valueList which of course is the supplied answer. However from the behaviour that gets mimicked you would expect the implementation to look for the suppliedAnswer in the labelList - the same as you click on the label and not on its connected value. Additionally this produces less readable / understandable code compared to supplying the label, especially if the value happens to be a block.
With the new implementation, the answer is searched in the labelList, and the returned value is the coresponding value from the valueList.
=============== Diff against ToolBuilder-Morphic-mt.260 ===============
Item was changed:
----- Method: MorphicUIManager>>chooseFrom:values:lines:title: (in category 'ui requests') -----
chooseFrom: labelList values: valueList lines: linesArray title: aString
"Choose an item from the given list. Answer the selected item."
| index |
self askForProvidedAnswerTo: aString ifSupplied: [:answer |
(answer = #cancel or: [answer isNil]) ifTrue: [^ nil].
+ ^ valueList at: (labelList indexOf: answer) ifAbsent: [
- ^ valueList at: (valueList indexOf: answer) ifAbsent: [
answer isNumber
ifTrue: [valueList at: answer ifAbsent: [nil]]
ifFalse: [nil]]].
index := self chooseFrom: labelList lines: linesArray title: aString.
^ index = 0
ifTrue: [ nil ]
ifFalse: [ valueList at: index ]!
Marcel Taeumel uploaded a new version of WebClient-Core to project The Trunk:
http://source.squeak.org/trunk/WebClient-Core-ct.124.mcz
==================== Summary ====================
Name: WebClient-Core-ct.124
Author: ct
Time: 31 August 2020, 1:54:11.685896 am
UUID: b0d7790c-c195-6e4d-ad0f-fce8cf8b3b00
Ancestors: WebClient-Core-ul.123
Fixes a syntax error in multipart/form-data encoding
Phew! It costed me a few hours to track some higher-level application bug down to this low level code ...
=============== Diff against WebClient-Core-ul.123 ===============
Item was changed:
----- Method: WebUtils class>>encodeMultipartForm:boundary: (in category 'decoding') -----
encodeMultipartForm: fieldMap boundary: boundary
"Encodes the fieldMap as multipart/form-data.
The fieldMap may contain MIMEDocument instances to indicate the presence
of a file to upload to the server. If the MIMEDocument is present, its
content type and file name will be used for the upload.
The fieldMap can be EITHER an array of associations OR a Dictionary of
key value pairs (the former is useful for providing multiple fields and/or
specifying the order of fields)."
^String streamContents:[:stream|
(fieldMap as: Dictionary) keysAndValuesDo:[:fieldName :fieldValue | | fieldContent |
"Write multipart boundary and common headers"
stream nextPutAll: '--', boundary; crlf.
stream nextPutAll: 'Content-Disposition: form-data; name="', fieldName, '"'.
"Figure out if this is a file upload"
(fieldValue isKindOf: MIMEDocument) ifTrue:[
+ stream nextPutAll: '; filename="', fieldValue url pathForFile, '"'; crlf.
- stream nextPutAll: ' filename="', fieldValue url pathForFile, '"'; crlf.
stream nextPutAll: 'Content-Type: ', fieldValue contentType.
fieldContent := (fieldValue content ifNil:[
(FileStream readOnlyFileNamed: fieldValue url pathForFile) contentsOfEntireFile.
]) asString.
] ifFalse: [fieldContent := fieldValue].
stream crlf; crlf.
stream nextPutAll: fieldContent asString.
stream crlf.
].
stream nextPutAll: '--', boundary, '--', String crlf.
].
!
Marcel Taeumel uploaded a new version of WebClient-Core to project The Trunk:
http://source.squeak.org/trunk/WebClient-Core-mt.126.mcz
==================== Summary ====================
Name: WebClient-Core-mt.126
Author: mt
Time: 1 October 2020, 3:50:05.23448 pm
UUID: ac088027-30e2-9c4e-8f43-c1b651186f3d
Ancestors: WebClient-Core-mt.124, WebClient-Core-ct.124
Merges WebClient-Core-ct.124
=============== Diff against WebClient-Core-mt.124 ===============
Item was changed:
----- Method: WebUtils class>>encodeMultipartForm:boundary: (in category 'decoding') -----
encodeMultipartForm: fieldMap boundary: boundary
"Encodes the fieldMap as multipart/form-data.
The fieldMap may contain MIMEDocument instances to indicate the presence
of a file to upload to the server. If the MIMEDocument is present, its
content type and file name will be used for the upload.
The fieldMap can be EITHER an array of associations OR a Dictionary of
key value pairs (the former is useful for providing multiple fields and/or
specifying the order of fields)."
^String streamContents:[:stream|
(fieldMap as: Dictionary) keysAndValuesDo:[:fieldName :fieldValue | | fieldContent |
"Write multipart boundary and common headers"
stream nextPutAll: '--', boundary; crlf.
stream nextPutAll: 'Content-Disposition: form-data; name="', fieldName, '"'.
"Figure out if this is a file upload"
(fieldValue isKindOf: MIMEDocument) ifTrue:[
+ stream nextPutAll: '; filename="', fieldValue url pathForFile, '"'; crlf.
- stream nextPutAll: ' filename="', fieldValue url pathForFile, '"'; crlf.
stream nextPutAll: 'Content-Type: ', fieldValue contentType.
fieldContent := (fieldValue content ifNil:[
(FileStream readOnlyFileNamed: fieldValue url pathForFile) contentsOfEntireFile.
]) asString.
] ifFalse: [fieldContent := fieldValue].
stream crlf; crlf.
stream nextPutAll: fieldContent asString.
stream crlf.
].
stream nextPutAll: '--', boundary, '--', String crlf.
].
!
Marcel Taeumel uploaded a new version of WebClient-Core to project The Trunk:
http://source.squeak.org/trunk/WebClient-Core-mt.124.mcz
==================== Summary ====================
Name: WebClient-Core-mt.124
Author: mt
Time: 1 October 2020, 3:33:31.12048 pm
UUID: ded69be5-bdb0-ea47-9289-4c4d01285b08
Ancestors: WebClient-Core-ul.123
Merges WebClient-Core-monty.113 (-> treated), which fixes the missing #closeIfTransient for #getContentWithProgress:. However, do it differently than proposed, that is, use the template method that is re-used in subclasses.
=============== Diff against WebClient-Core-ul.123 ===============
Item was removed:
- ----- Method: WebResponse>>content (in category 'accessing') -----
- content
- "Reimplemented to close the socket if the request is transient"
-
- content ifNil:[
- content := self getContent.
- self closeIfTransient.
- ].
- ^content!
Item was removed:
- ----- Method: WebResponse>>getContent (in category 'private') -----
- getContent
- " Any response to a HEAD request and any response with a 1xx
- (Informational), 204 (No Content), or 304 (Not Modified) status
- code is always terminated by the first empty line after the
- header fields, regardless of the header fields present in the
- message, and thus cannot contain a message body.
- - https://tools.ietf.org/html/rfc7230#section-3.3.3 "
-
- (request method = 'HEAD' or: [(code between: 100 and: 199) or: [code = 204 or: [code = 304]]]) ifTrue:[^''].
- ^super getContent!
Item was added:
+ ----- Method: WebResponse>>getContentWithProgress: (in category 'private') -----
+ getContentWithProgress: progressBlockOrNil
+ "Any response to a HEAD request and any response with a 1xx (Informational), 204 (No Content), or 304 (Not Modified) status code is always terminated by the first empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message body. See https://tools.ietf.org/html/rfc7230#section-3.3.3 "
+
+ [
+ (request method = 'HEAD'
+ or: [(code between: 100 and: 199)
+ or: [code = 204
+ or: [code = 304]]]) ifTrue: [^ ''].
+
+ ^ super getContentWithProgress: progressBlockOrNil
+
+ ] ensure: [self closeIfTransient]!