MAStringWriter >> visitContainer: aDescription

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MAStringWriter >> visitContainer: aDescription

Steve McCusker
I have been playing around with Seaside, Magritte and Glorp with the
intention of converting (or just adding to) a web application I started
using Django and Python. The data is stored in a PostgreSQL database.

I have some of the Magritte list views working but one of them wasn't. A
column was not displaying properly. The column should display a
MAToOneRelationDescription, the target object of which had four separate
string components. The list view was only displaying the first of these.

I think the fault is in MAStringWriter >> visitContainer: aDescription. The
original method was like this:

visitContainer: aDescription
        aDescription do:
    [ :each |
      each isVisible ifTrue:
        [
          each stringWriter
            write: (self object readUsing: each)
            description: each to: stream.
          ^ self
         ]
    ].

But I think the ^self should be outside the iteration. When I changed the
method to:

visitContainer: aDescription
  aDescription do:
    [ :each |
      each isVisible ifTrue:
        [
          each stringWriter
            write: (self object readUsing: each)
            description: each to: stream.
         ]
    ].
    ^ self

I get all four components displayed (unfortunately without any spacing but I
guess that is a separate problem.

Cheers

Steve McCusker

PS My image is sq3.9-7067web08.01.1


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MAStringWriter >> visitContainer: aDescription

Lukas Renggli
> I think the fault is in MAStringWriter >> visitContainer: aDescription. The
> original method was like this:

This is intentional. The decision was by default to only display the
first visible description for relationships. Of course you can change
that as you have done.

As I mentioned already several times, from a framework point of view
relationships lead to an explosion of meaningful ways to display,
edit, and validate the associated data. Magritte has chosen one of
these possibilities. You have to subclass or reconfigure the
descriptions if you want something else.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki