[Seaside] Storing WAComponent / WATask etc. in magma

Philippe Marschall philippe.marschall at gmail.com
Tue Dec 23 12:06:45 UTC 2008


2008/12/23 Florian Obser <florian at narrans.de>:
> Hi all,
>
> I'm writing a seaside application in which I'm modeling the access a
> logged in user has on various object as views / tasks on collections (or
> subsets of collections) which are stored in magma.
>
> e.g. in terms of a blog application: blog posts are stored in magma in a
> collection. The master user has access to all posts but rather than
> having an instance variable which holds a collection of blog posts the
> user has an instance variable which holds a view on the blog posts to
> which this user has access. This view is a subclass of WAComponent or in
> case of editing / creating a new blog post a subclass of WATask. (Other
> users have views which operate on different subsets of the blog posts
> collection, but I can have a second master user simply by providing a
> view on all posts). I hope this makes sense...

Don't do that. Components are session specific.

> At first I stored these components / tasks in magma but it didn't work.
>
> I changed the design and created a new class hierarchy subclassing
> Object  and stored these objects in magma. These new classes essentially
> store configuration data for the different views and provide a single
> message which creates a new WAComponent (or task).

That's the way to go. You don't necessarily have to use a class
hierarchy, you can use arbitrary configuration objects that hold on to
class names and other configuration values.

> Later I noticed two thinks:
>
> 1) The reason why my application didn't work as expected probably hat
>   nothing to do with storing the components in magma
> 2) I'm creating two class hierarchies which do essentially the same,
>   there is one class to store the view in magma (subclassing Object)
>   and another class subclassing WAComponent to create the view.
>
> Before changing everything back (this will be a lot of work) and storing
> WAComponents in magma I wanted to ask first if this will work? Do I have
> to expect some strange behavior? Is this a good idea[tm]?

Cheers
Philippe


More information about the seaside mailing list