[Checkins] SVN: Products.GenericSetup/branches/1.4/Products/GenericSetup/ Backport [118573]
Laurence Rowe
l at lrowe.co.uk
Wed Nov 24 14:04:54 EST 2010
Log message for revision 118574:
Backport [118573]
Changed:
U Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt
U Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py
U Products.GenericSetup/branches/1.4/Products/GenericSetup/tool.py
-=-
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt 2010-11-24 18:46:58 UTC (rev 118573)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt 2010-11-24 19:04:53 UTC (rev 118574)
@@ -4,6 +4,8 @@
1.4.7 (Unreleased)
------------------
+- Toolset import: Support replacement of subclassed tools. (Backport)
+
1.4.6 (2010-09-02)
------------------
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py 2010-11-24 18:46:58 UTC (rev 118573)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py 2010-11-24 19:04:53 UTC (rev 118574)
@@ -1373,7 +1373,7 @@
mandatory._setId( 'mandatory' )
site._setObject( 'mandatory', mandatory )
- obligatory = AnotherDummyTool()
+ obligatory = SubclassedDummyTool()
obligatory._setId( 'obligatory' )
site._setObject( 'obligatory', obligatory )
@@ -1438,6 +1438,10 @@
pass
+class SubclassedDummyTool(DummyTool):
+
+ pass
+
class DummyToolRequiresId( Folder ):
def __init__(self, id):
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/tool.py
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/tool.py 2010-11-24 18:46:58 UTC (rev 118573)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/tool.py 2010-11-24 19:04:53 UTC (rev 118574)
@@ -138,7 +138,8 @@
site._setObject(tool_id, new_tool)
else:
unwrapped = aq_base(existing)
- if not isinstance(unwrapped, tool_class):
+ # don't use isinstance here as a subclass may need removing
+ if type(unwrapped) != tool_class:
site._delObject(tool_id)
site._setObject(tool_id, tool_class())
More information about the checkins
mailing list