Ticket #112 (closed defect: fixed)

Opened 2 months ago

Last modified 1 month ago

events problem

Reported by: wrobe..@pld-linux.org Assigned to: arj..@yirdis.nl
Priority: blocker Milestone: Gaphor 0.13.0
Component: Gaphor Version:
Keywords: Cc:

Description

try to load a diagram item containing join node. the error will be displayed

Traceback (most recent call last):
  File "./gaphor/storage/storage.py", line 344, in load_generator
    for percentage in load_elements_generator(elements, factory, gaphor_version):
  File "./gaphor/storage/storage.py", line 293, in load_elements_generator
    elem.element.postload()
  File "./gaphor/diagram/activitynodes.py", line 253, in postload
    super(ForkNodeItem, self).postload()
  File "./gaphor/diagram/diagramitem.py", line 196, in postload
    self.on_presentation_subject(None)
  File "./gaphor/diagram/diagramitem.py", line 287, in on_presentation_subject
    handler(None)
  File "./gaphor/diagram/activitynodes.py", line 341, in on_join_node_join_spec
    (event.element is subject.joinSpec or \
AttributeError: 'NoneType' object has no attribute 'element'

this is because None is passed as an event instance. if there is no event, then callback should not be called?

Attachments

Change History

03/13/08 08:02:50 changed by wrobe..@pld-linux.org

  • priority changed from major to blocker.

(follow-up: ↓ 3 ) 03/13/08 08:22:54 changed by arj..@yirdis.nl

The None event is passed by the handler for Presentation.subject. If the subject changes, all handlers are called with a None event.

I know it's a bit lame, but it was the only thing I could think of at the time (otherwise in most cases checks are done to see if event.element and event.property match).

(in reply to: ↑ 2 ; follow-up: ↓ 4 ) 03/13/08 09:42:35 changed by wrobe..@pld-linux.org

Replying to arj..@yirdis.nl:

The None event is passed by the handler for Presentation.subject. If the subject changes, all handlers are called with a None event. I know it's a bit lame, but it was the only thing I could think of at the time (otherwise in most cases checks are done to see if event.element and event.property match).

what about adding Event.subject attribute to indicate that subject has changed instead?

current approach is bit error prone, i.e.

  • this bug
  • FlowItem?.on_control_flow_guard is going to blow up, too

and forces us for quite verbose programming

(in reply to: ↑ 3 ) 03/17/08 03:07:15 changed by arj..@yirdis.nl

Replying to wrobe..@pld-linux.org:

what about adding Event.subject attribute to indicate that subject has changed instead?

That would yield the same result, wouldn't it. Then the subject is given as Event.element. What should be passed as Event.property (indicating the property that has changed)? Presentation.subject?

current approach is bit error prone, i.e. * this bug * FlowItem?.on_control_flow_guard is going to blow up, too and forces us for quite verbose programming

I know. It's far from ideal.

04/07/08 01:21:22 changed by arj..@yirdis.nl

  • status changed from new to closed.
  • resolution set to fixed.

(In [2287]) Fixes #112 and make flow/fork/decision unit tests pass.


Add/Change #112 (events problem)




Action