Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1309 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

[PATCH] SELECTED attributes of SelectionField won't disappear once it gets selected

Reported by: ts1 Owned by: alberto
Priority: normal Milestone: 1.0.2
Component: TG Widgets Version: 1.0
Severity: normal Keywords:
Cc:

Description

The original code adds _selected_verb attributes to user-supplied options list. If the list is defined globally in user code, the added attributes won't disappear until server restart.

My patch removes (well, sets to None) the attribute when it's not selected.

Attachments

selected.patch Download (743 bytes) - added by ts1 12 years ago.
dict_copy.patch Download (593 bytes) - added by ts1 12 years ago.
Copies attribute dictionary.

Change History

Changed 12 years ago by ts1

comment:1 Changed 12 years ago by ts1

Same patch should be applied to trunk.

comment:2 Changed 12 years ago by alberto

  • Owner changed from anonymous to alberto
  • Status changed from new to assigned

Hmmm, I believe I solved this problem in TW but, dummy me, forgot to backport the fix into TG widgets. I'm pretty sure the problem is that SleectionField? modifies the list in update_params instead of a copy. Your fix suffers from the same problem as it mutates a global object in an unthreadsafe way.

Can you try [2768] to see if it's fixed?

Alberto

P.S To myself, merge the fix if it closes this into trunk and cp3 branch

comment:3 follow-up: ↓ 4 Changed 12 years ago by ts1

Yes, [2768] fixed my problem. Thanks.

However, I am not pretty sure if your fix is really thread-safe. If an application has third item (options_attr) statically (mine doesn't), wouldn't it be modified? Line 904 should copy the dictionary?

comment:4 in reply to: ↑ 3 Changed 12 years ago by alberto

Replying to ts1:

Yes, [2768] fixed my problem. Thanks.

However, I am not pretty sure if your fix is really thread-safe. If an application has third item (options_attr) statically (mine doesn't), wouldn't it be modified? Line 904 should copy the dictionary?

Yep, looks like it should be copied too. Would you mind sending a patch for that?

Thanks, Alberto

Changed 12 years ago by ts1

Copies attribute dictionary.

comment:5 Changed 12 years ago by alberto

  • Status changed from assigned to closed
  • Resolution set to fixed

Applied at [2784].

Thanks!

Alberto

Note: See TracTickets for help on using tickets.