[Kss-devel] A bug report and the patch about the parentnode selector (a more test included)

rae l crquan at gmail.com
Thu Mar 22 11:53:49 CET 2007


I found the the class in plugins/core/commands.py did not agree with
its interface defined in plugins/core/interfaces.py, this is an
appreant error.

here follows the patch.

Index: plugins/core/commands.py
===================================================================
--- plugins/core/commands.py    (revision 40871)
+++ plugins/core/commands.py    (working copy)
@@ -19,11 +19,11 @@
     def getHtmlIdSelector(self, selector):
         return HtmlIdSelector(selector)

-    def getSameNodeSelector(self, selector):
-        return SameNodeSelector(selector)
+    def getSameNodeSelector(self):
+        return SameNodeSelector()

-    def getParentNodeSelector(self):
-        return ParentNodeSelector()
+    def getParentNodeSelector(self, selector):
+        return ParentNodeSelector(selector)

     # XXX the list is not full: maybe complete them?

Index: tests/test_azaxview_core.py
===================================================================
--- tests/test_azaxview_core.py (revision 40871)
+++ tests/test_azaxview_core.py (working copy)
@@ -125,6 +125,20 @@
 '''
         self.assertCommandsEqual(result, awaited)

+    def test_parentNode(self):
+        view = self.createView()
+        core = view.getCommandSet('core')
+        selector = core.getParentNodeSelector('div')
+        core.replaceInnerHTML(selector, 'OK')
+        result = view.render()
+        awaited = u'''\
+<kukit:command selector="div" name="replaceInnerHTML"
+               selectorType="parentnode">
+    <kukit:param name="html">OK</kukit:param>
+</kukit:command>
+'''
+        self.assertCommandsEqual(result, awaited)
+
 def afterSetUp(self):
     KssViewTestCase.afterSetUp(self)
     self.setDebugRequest()


-- 
程任全

上海润普网络信息技术有限公司(http://zopen.cn)
中文Zope用户组(http://czug.org)
Tel: 021-22818213


More information about the Kss-devel mailing list