is there any photo gallery available for Pier? I mean a widget where I
could upload pictures and they are rendered in a nice way. I started
one 4 years ago but I abandoned it.
I have been working on understanding Magritte and tried the First
Example in the Seaside Book (Lulu publication, page 358, section 24.2).
The Example failed to run, apparently because the method keyword,
accessor:, in the descriptions wasn't recognized. When I added my own
getters and setters for the instance variable names (street, plz, etc)
everything in the Example worked fine.
Is the code in the Example perhaps outdated? Could someone suggest what
method I might use? I tried asAccessor: and selectorAccessor: with no
Today I checked-in a fix which reverts a change I made to try to stop
multiple PRContextFilter s being added to the session filter chain.
Unfortunately the fix caused unintended side-effects, which I believe
contributed to the problems Sergio mentioned. Hopefully the reversion
should fix some or all of these problems.
However there's still an issue with the interaction of PRContext,
PRContextFilter, cookies, component creation and Restful urls. To
illustrate the issue execute the following:
| app rootPage |
rootPage := (PRPage named: 'rootPage') contents: '+counter+'; yourself.
rootPage localEnvironment: ((PRComponent named: 'contents')
componentClass: PRContentsWidget; yourself).
rootPage addChild: ((PRComponent named: 'counter') componentClass:
app := PRPierFrame registerAsApplication: 'contexttest' kernel: (PRKernel
named: 'contexttest' root: rootPage).
then browse to http://localhost:8080/contexttest You should see a counter
instance. Increment the value of the counter once. Then in a new window/tab
of the same browser, browse to same url (http://localhost:8080/contexttest)
and decrement the value of the counter once. Now return to the original
value and increment again - the counter displays the value "-1" rather than
If I try the same test in Pier 1, (note in Pier 1 you'll have to manually
enable cookies through the /config), when I first browse to the second tab,
the counter already displays "1".
What's happening? In the Pier 2 case:
* PRPierFrame>>#initialRequest is called for every Restful url. There is no
distinction between a call when a new session has been created and a call
with an existing session.
* In PRPierFrame>>#initialRequest a new PRContextFilter is added to the
session: "self session addFilter: (PRContextFilter on: self)"
* In WASession>>#handleFiltered: aRequestContext, if there is no
continuation key, #start is called on the session, which creates a new root
component - in this case a new PRPierFrame.
* So every time we browse to a Restful url a new PRPierFrame is created
which holds the PRContext. This context is then "held" by the
What does this mean in our counter example:
In the first tab a new session is created, a new PRPierFrame, a new
PRContextFilter and a new WACounter instance are created. The link to
increment the counter contains a continuation key so #initialRequest isn't
called and callback is fired incrementing the counter which in turn
In the second tab the session already exists, however without a
continuation key a new PRPierFrame, a new PRContextFilter and a new
WACounter instance are created. Decrementing the counter decrements it on
the new WACounter instance.
Now returning to the first tab we again try to increment the counter. The
callback on the first component created is called and the counter is
incremented. However in the rendering phase, the second component created
in the second tab is displayed, with it's counter unincremented and set to
What are the problems:
* There is no distinction between #initialRequest called with a newly
created session and #initialRequest called from a session recovered via a
cookie. Neither is there an obvious way of detecting for which case
has been called.
* Within WASession>>#handleFiltered: if no continuation key exists a new
root component is created.
* A new PRContextFilter is added for each Restful call.
Two possible solutions:
* A new PRPierFrame is only created when a new session is created. This
should then function as Pier 1. However if the root presenter is exchanged
in one open tab e.g. with a #call or #show on the root, then other open
tabs will not operate as intended. The implementation would I think require
a custom session with a custom #handleFiltered: or alternatively a modified
WASession which allows configurable behaviour when there's no continuation
* If however we want to allow for multiple components so that state isn't
maintained between two identical Restful - that is both counters start at
0. Then we could move PRContext into the session, and remove the
I hope this makes sense I've I understood the situation correctly. Any
I've checked-in an initial port of Pier using Magritte with pragma support
into: http://source.lukas-renggli.ch/pier2unstable - all tests are green
and with a cursory test everything appears to be functioning as before.
The port includes the following packages:
and the following add ons:
1) Be great if people can try the initial port and report any errors or
2) If success with 1) perhaps we can move to new repositories (e.g.
Magritte3, Pier3, Pier3addons)
3) Continue porting addons. There are many add-ons in both
http://source.lukas-renggli.ch/pier2addons that would be great to port.
4) Document the changes to Magritte and how they effect Pier.
*1) search for all instances of #description if they are magritte
descriptions rename the method #magritteDescription
2) remove #magritteDynamic and remove the block around the method.
3) Use the refactoring support to move class-side descriptions to instance
side descriptions with pragmas - making sure that any accessors to class
side methods are either prefixed with ‘class’ or moved to the instance
side. If you move description help methods to instance side be careful if
they contain context := PRCurrentContext value - context will shadow an
instance variable of the same name so either replace context with self
context and remove context := PRCurrentContext value or rename context say
theContext and replace context := PRCurrentContext value with theContext :=
4) Remove any empty categories on the class side.*
*5) PRWidget derived classes should either by modified to be derived from
PRWidgetPropertyBase or keep derived from **PRWidget but modify the
accessors to store state in instance variable rather than the property
dictionary in **PRWidgetPropertyBase. See PRViewsWidget and PRSearchWidget
for examples of both types of port.*
*6) Modify structure initialisation with PRComponent to use prototype
instance rather than classes. So*
(PRComponent named: 'contents')
write: '%c' using: PRContentsWidget descriptionHeading;
(PRComponent named: 'contents') prototypeInstance: (PRContentsWidget new
heading: '%c'; yourself)
you may well have to add setters to allow initial settings to be set on the
prototype instances again see **PRViewsWidget and **PRSearchWidget for
*7) P**ut a break point in Object>>description and Object
class>>description to trap any cases you’ve missed (the break-point should
not be hit) and check the add-on.*
*Hope this makes sense*