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 #465 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

[patch] Widget options types.FunctionType not applicable to __call__ objects

Reported by: rick.richardson@… Owned by: rick.richardson@…
Priority: normal Milestone: 0.9
Component: TG Widgets Version:
Severity: normal Keywords:
Cc:

Description

The widgets.OptionWidget? function get_options grabs the options attribute and then checks to see if options is a function by calling checking its type against types.FunctionType?.

This does not succeed for objects that are not of that type but are still callable via the call method, like curried objects.

If we instead check to see if options is callable() it will be a more general solution, and more readable imo.

Attachments

base_options.patch Download (382 bytes) - added by rick.richardson@… 13 years ago.

Change History

comment:1 Changed 13 years ago by rick.richardson@…

the patch

Index: base.py =================================================================== --- base.py (revision 581) +++ base.py (working copy) @@ -422,7 +422,7 @@

"""Returns list of options"""

options = getattr(self, "options", [])

+ if callable(options):

return options()

return options

Changed 13 years ago by rick.richardson@…

comment:2 Changed 13 years ago by anonymous

  • Summary changed from Widget options types.FunctionType not applicable to __call__ objects to [patch] Widget options types.FunctionType not applicable to __call__ objects

comment:3 Changed 13 years ago by kevin

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

committed in [602]. thanks!

comment:4 Changed 13 years ago by kevin

  • Milestone set to 0.9
Note: See TracTickets for help on using tickets.