Author: jvloothuis
Date: Thu Oct 18 20:29:53 2007
New Revision: 47561

Modified:
   kukit/kss.base/trunk/kss/base/commands.py
   kukit/kss.base/trunk/kss/base/commands.txt
Log:

Added test for the default selector (pass a string and it will be
converted to css)


Modified: kukit/kss.base/trunk/kss/base/commands.py
==============================================================================
--- kukit/kss.base/trunk/kss/base/commands.py   (original)
+++ kukit/kss.base/trunk/kss/base/commands.py   Thu Oct 18 20:29:53 2007
@@ -1,6 +1,7 @@
 from xml.sax.saxutils import quoteattr, escape
 from kss.base.registry import command_set_registry
-from kss.base import selectors
+from kss.base.selectors import Selector
+from kss.base.coreselectors import css
 
 kss_response_header = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:kukit="http://www.kukit.org/commands/1.0";><body><kukit:commands>'''
@@ -21,9 +22,8 @@
     def add(self, action, selector, **kwargs):
         self._strip_none_parameters(kwargs)
 
-        if selector is not None and not isinstance(selector,
-                                                   selectors.Selector):
-            selector = selectors.css(selector)
+        if selector is not None and not isinstance(selector, Selector):
+            selector = css(selector)
 
         self.commands.append((action, selector, kwargs))
 

Modified: kukit/kss.base/trunk/kss/base/commands.txt
==============================================================================
--- kukit/kss.base/trunk/kss/base/commands.txt  (original)
+++ kukit/kss.base/trunk/kss/base/commands.txt  Thu Oct 18 20:29:53 2007
@@ -79,6 +79,15 @@
   >>> print commands
   parameterCommand(css('#something'), value='Testing')
 
+You can also use strings instead of a selector instance as a value for
+selector. In this case the string will automatically be converted to a
+CSS selector.
+
+  >>> commands.clear()
+  >>> commands.add('replaceHTML', '#someid', html='some value')
+  >>> print commands
+  replaceHTML(css('#someid'), html='some value')
+
 
 Command sets
 ============
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to