'From etoys4.0 of 9 October 2008 [latest update: #2303] on 14 September 2009 at 12:59:12 pm'! "Change Set: bulletproofCats-sw Date: 14 September 2009 Author: Scott Wallace Provide some bulletproofing against the possibility that the project-category information obtained from the squeakland web site might be corrupt."! !EToyProjectDetailsMorph class methodsFor: 'classification information' stamp: 'sw 9/14/2009 12:56'! updateTripletsFromWebSite "Attempt to update the age-range, subject, and region triplets stored in the image by referring to the latest versions on the web site." | url result suffix | suffix := '?lang=', Locale current localeID printString. url := 'http://squeakland.org/subjectCatList', suffix. [result := (self linesIn: (((HTTPSocket httpGet: url args: #() user: '' passwd: '')) contents copyReplaceAll: String lf with: String cr)) collect: [:l | self csvLineQuotedDecodedFor: l]] on: Error do: [:ex | ^ self]. (self validateCategoryTriplets: result) ifFalse: [^ self]. SubjectTriplets := result. url := 'http://squeakland.org/ageCatList', suffix. [result := (self linesIn: (((HTTPSocket httpGet: url args: #() user: '' passwd: '')) contents copyReplaceAll: String lf with: String cr)) collect: [:l | self csvLineQuotedDecodedFor: l]] on: Error do: [:ex | ^ self]. (self validateCategoryTriplets: result) ifFalse: [^ self]. AgeTriplets := result. url := 'http://squeakland.org/regionCatList', suffix. [result := (self linesIn: (((HTTPSocket httpGet: url args: #() user: '' passwd: '')) contents copyReplaceAll: String lf with: String cr)) collect: [:l | self csvLineQuotedDecodedFor: l]] on: Error do: [:ex | ^ self]. (self validateCategoryTriplets: result) ifFalse: [^ self]. RegionTriplets := result " EToyProjectDetailsMorph updateTripletsFromWebSite "! ! !EToyProjectDetailsMorph class methodsFor: 'classification information' stamp: 'sw 9/14/2009 12:59'! validateCategoryTriplets: aList "The input is a tuple obtained by extracting lines from a string obtained from the squeakland web site. Answer true if the tuple passes the smoke-test for category triplets." (aList isNil or: [aList size < 2]) ifTrue: [^ false]. aList do: [:element | (element isCollection not or: [element size < 3]) ifTrue: [^ false]]. ^ true " self validateCategoryTriplets: RegionTriplets "! !