[#156] ClassGroup.__repr__

Date:
2006-07-03 09:15
Priority:
2
State:
Open
Submitted by:
Frank Koormann (frank)
Assigned to:
Frank Koormann (frank)
Category:
none
Version:
none
Resolution:
none
Summary:
ClassGroup.__repr__

Detailed description
__repr__ of ClassGroup and its childs doesn't make clear that it is the repr of an instance of ClassGroup and not a simple tuple/list.
Message  ↓
Date: 2007-06-23 19:35
Sender: Frank Koormann

I'm back on this and will elaborate a bit more:

1. Change the ClassGroup interface from
ClassGroup(label = "", props = None, group = None)
to
ClassGroup(props = None, label = "", group = None)

Rationale: The interface of ClassGroup differs from the interfaces of all
derived classes. The patch harmonizes the interfaces. Since
ClassGroup is only used as a base class the change affects only a
couple of files.

2. Change the ClassGroupProperties interface from
ClassGroupProperties(props)
to
ClassGroupProperties(lineColor = Black, lineWidth = 1,
size = 5, fill = Transparent)

Rationale:
In the current interface, props is a ClassGroupProperties object.
This recursion makes it impossible to implement a eval(repr())
for ClassGroupProperties, which are used by ClassGroup.

3. Change the __repr__ methods to realize eval(repr())
This should include more tests as your findings point out.

I propose to do the changes in three steps

Date: 2006-10-16 14:58
Sender: Bernhard Reiter

Ping Frank.

Date: 2006-09-11 13:45
Sender: Bernhard Reiter

Here is a testcase.
Frank, your patch fails the testcase, because
it does not output "ClassGroup" in front of the brackets.

Also: Are you sure that there are no other bad side effects in changing the ClassGroup interface? This seem to be two different things: a) making __repr__() output something reasonable and changing the constructor interface.

Date: 2006-07-07 21:06
Sender: Frank Koormann

In personal communication Bernhard Herzog suggested that the repr in combination with eval() should again result in an instance of the same class.

I had to modify especially ClassGroupProperty, since the constructor expected an object and not the attributes representing it.

Please test the attached patch.

Frank

Attachments:
Size Name Date By Download
8 KiBrepr.patch2006-07-07 21:06Frank Koormannrepr.patch
1 KiBtestcase-repr.diff2006-09-11 13:45Bernhard Reitertestcase-repr.diff
Field Old Value Date By
priority32006-09-11 13:45Bernhard Reiter
File Added30: testcase-repr.diff2006-09-11 13:45Bernhard Reiter
File Added25: repr.patch2006-07-07 21:06Frank Koormann