Ciao,
i found this problem and i ask indications, suggestions how to solve it properly and permanently. The BWRecaptchaComponent verify method : verify work on the stream with: stream upToAll: String crlf, String crlf. The upToAll: behaves differently into Pharo and into GLASS. In this respect the GLASS define the upToAndSkipThroughAll: method. And i need to use it ( upToAndSkipThroughAll: ) into GLASS environment BWRecaptchaComponent verify method for correctly execution of the method itself. Now my question is how i can manage the verify method with two different implementations? One for Pharo ( with upToAll: ) and one for Glass ( with: upToAndSkipThroughAll ) I need to create a ConfigurationOfBWRecaptcha with to different package reference one for Pharo and one for Gemstone ? or i can test at runtime if the verify method is run into GLASS ? Or ...... ???? Thanks for any consideration. Dario |
Dario,
Yes, you need to create a separate version of the BWRecaptchaComponent method that uses upToAndSkipThroughAll: .... An alternative is to arrange to use an instance of ReadStreamPortable with the BWRecaptchaComponent ... without knowing too many of the details, you may still end up having to create a gemstone-specific branch of BWRecaptchaComponent anyway, but it's worth mentioning anyway. PositionStreamPortable and subclasses is an ANSI compatible Stream implementation that is also compatible with the Pharo implementation (no itsCollection and semantics of position are the same, etc.) and PositionableStreamPortable>>upToAll: implementation matches that in Pharo ... so if you can arrange to use the ReadStreamPortable class without modifying the BWRecaptchaComponent, then this is a good solution. Finally, take a look at the senders of #upToAll: in your repository ... if you don't have too many senders of upToAll:, you can consider patching upToAll: to use the upToAndSkipThroughAll: implementation ... Dale ----- Original Message ----- | From: "Dario Trussardi" <[hidden email]> | To: "beta discussion Gemstone Seaside" <[hidden email]> | Sent: Thursday, January 31, 2013 3:55:22 AM | Subject: [GS/SS Beta] BWRecaptchaComponent upToAll: method call into GLASS | | Ciao, | | i found this problem and i ask indications, suggestions how to solve | it properly and permanently. | | The BWRecaptchaComponent verify method : | | | | verify | | result stream valid | | self hasConfiguration ifFalse: [^false]. | (response isNil or: [response isEmpty]) ifTrue: [ | errorCode := 'incorrect-captcha-sol'. | ^false]. | result := self fetchResult. | challenge := response := nil. | result ifNil: [ | errorCode := 'recaptcha-not-reachable'. | ^false]. | stream := ReadStream on: result. | "Skip header" | stream "upToAll:" upToAndSkipThroughAll: String crlf, String crlf. | | "First line is either true or false if the response was correct" | valid := ((stream upTo: Character lf) copyFrom: 1 to: 4) = 'true'. | errorCode := valid | ifTrue: [nil] | ifFalse: [stream upToEnd]. | result := nil. | ^ valid | | work on the stream with: | | stream upToAll: String crlf, String crlf. | | The upToAll: behaves differently into Pharo and into GLASS. | | In this respect the GLASS define the upToAndSkipThroughAll: method. | | | | | And i need to use it ( upToAndSkipThroughAll: ) into GLASS | environment BWRecaptchaComponent verify method | | | for correctly execution of the method itself. | | | Now my question is how i can manage the verify method with two | different implementations? | | | One for Pharo ( with upToAll: ) and one for Glass ( with: | upToAndSkipThroughAll ) | | | | | I need to create a ConfigurationOfBWRecaptcha with to different | package reference one for Pharo and one for Gemstone ? | | | or i can test at runtime if the verify method is run into GLASS ? | | | Or ...... ???? | | | Thanks for any consideration. | | | Dario | | | | | | | | | | | | | | | |
Free forum by Nabble | Edit this page |