Moving from 2.7 to 2.8
I did a quick run-through today to see what it would take to move our application from the most recent version of Seaside 2.7 to the brand-spanking-new 2.8 snapshot Michel published this morning. Here are some notes about the changes I had to make and a few rewrite snippets to give you a starting point if you run into the same issues (you may not though).
1. WACanvasTableReport has been renamed to WATableReport, you will need to fix any subclasses you may have added
2. There’s currently no way to subclass WAApplication in 2.8 in a configurable way, it was previously possible via #applicationClass and was used to implement custom #expiryPathFor: behavior; I’ll see about integrating my changes with the main branch for good as I think generalized behavior in that area would benefit many
3. Preference called #useSessionCookie is no longer there, so the following will fail miserably,
(self registerAsApplication: ‘cooler’)
preferenceAt: #useSessionCookie put: false;
yourself
instead, WACookieSession has been added as a subclass of WASession, so you’ll need to do,
(self registerAsApplication: ‘cooler’)
preferenceAt: #sessionClass put: WACookieSession;
yourself
or, if you already have your custom subclass of WASession and would like to have it use cookies for tracking, just move it and subclass off of WACookieSession instead.
4. #linkToScript: has been replaced with a much cleaner canvas-like API, previously it was used inside #updateRoot: to link to external JavaScript files (please note my use of #resourceUrl: instead of standard #url:, that is because I have a custom resource URL installed in #resourceBaseUrl preference and would like attached scripts to respect the prefix),
updateRoot: root
super updateRoot: root.
root linkToScript: ‘/other/charts/charts.js’.
instead you will need to use,
updateRoot: root
super updateRoot: root.
root javascript resourceUrl: ‘/other/charts/charts.js’.
and here’s a rewrite pattern to help you change your code in one go,
Search for:
“@root linkToScript: “@url
Replace with:
“@root javascript resourceUrl: “@url
5. Same goes for #linkToStyle: although I’ve been using a more complicated variant #linkToStyle:titled:media:, but rewrites come to the rescue once again,
Search for:
“@root linkToStyle: “@url titled: “@title media: ‘screen’.
Replace with:
“@root stylesheet url: “@url; addScreen
Search for:
“@root linkToStyle: “@url titled: “@title media: ‘print’.
Replace with:
“@root stylesheet url: “@url; addPrint
6. You can’t use awkward #heading:level: utility method to do,
html heading: ‘Need some help?’ level: 2.
instead use the full expanded API,
(html heading)
level: 2;
with: ‘Need some help?’.
or this simple rewrite (you can tell I’m fan, eh?),
Search for:
“@html heading: “@text level: “@level
Replace with:
“@html heading level: “@level; with: “@text
That’s about it for now, but I’m not all the way there yet as I now need to track down a nasty memory emergency that comes up when I try to submit a form, but I suspect it may be partly something in my code since I can’t reproduce it in the stock image, although it worked just fine for the longest time in 2.6 and 2.7, so I’m not fully convinced its my fault yet… More to follow.
Update 1: Okay, I found infinite recursion in Seaside’s codebase, seems to be the difference between Squeak and VisualWorks, but pretty easy to fix
Update 2: With a couple more fixes in place, we have liftoff. Exciting times and less painful than I was preparing for.
Very nice, I’m getting ready to do this upgrade as well for my site, I’m sure this’ll come in handy. I’ll write up my process as well.
Thanks man, I added the missing points (CookieSession, #heading:level:) to the Wiki on the SqS project page.
That’s a neat list indeed, Philippe. Others can find it by clicking on Wiki over at http://www.squeaksource.com/Seaside.html for more details.
In latest 2.8 the cookie behaviour has been reverted
Reverted how?