Edgewall Software

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#11023 closed enhancement (fixed)

Polymorphic access to section methods when calling Option accessor — at Version 4

Reported by: Olemis Lang <olemis+trac@…> Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.2
Component: general Version: 1.0-stable
Severity: minor Keywords: bloodhound configuration option descriptor polymorphism
Cc: Branch:
Release Notes:

Allow Section class to be overridden in classes that utilize the Option class and its derivatives.

API Changes:

Allow Section class to be overridden in classes that utilize the Option class and its derivatives.

Internal Changes:

Description

Subclasses of trac.config.Configuration have been implemented for Apache™ Bloodhound multi-product support . They store settings in the database instead of .ini files . They satisfy expected behavior since [ Trac config tests will pass]. Nonetheless some errors have been detected while using them together with Option descriptors .

The root cause is that trac.config.Option.accessor is set to unbound method trac.config.Section.get . This very same method is overriden by our sub-classes. Therefore Option.__get__ under the new circumstances will always fail because the more specialized method is never invoked.

Hence I'm proposing this patch to be committed upstream in order to enable method polymorphism on Section instances as a consequence of invoking Option.__get__ .

Change History (4)

comment:1 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Cc: ryan.j.ollos@… added

comment:2 by Christian Boos, 11 years ago

Milestone: 1.0.2

Looks harmless.

comment:3 by Ryan J Ollos, 11 years ago

Cc: ryan.j.ollos@… removed
Owner: set to Ryan J Ollos
Status: newassigned

Okay, I think I understand now. Unit tests still pass with Python 2.5 and 2.7, and this doesn't seem to break anything. Changes have been prepared for commit in rjollos.git:t11023.

comment:4 by Ryan J Ollos, 11 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [11991], and merged to trunk in [11992].

Thanks Olemis!

Note: See TracTickets for help on using tickets.