[KSS-checkins] r49284 - kukit/kss.base/trunk/kss/base
jvloothuis at codespeak.net
jvloothuis at codespeak.net
Sun Dec 2 16:04:40 CET 2007
Author: jvloothuis
Date: Sun Dec 2 16:04:40 2007
New Revision: 49284
Modified:
kukit/kss.base/trunk/kss/base/selectors.py
kukit/kss.base/trunk/kss/base/selectors.txt
Log:
Changed exception class for Selector instantition to be more in line with its purpose. Also made some improvements to the texts in the selectors.txt tests
Modified: kukit/kss.base/trunk/kss/base/selectors.py
==============================================================================
--- kukit/kss.base/trunk/kss/base/selectors.py (original)
+++ kukit/kss.base/trunk/kss/base/selectors.py Sun Dec 2 16:04:40 2007
@@ -11,7 +11,7 @@
value = ''
def __init__(self):
- raise Exception, 'Unimplemented'
+ raise NotImplementedError
def __str__(self):
return "%s('%s')" % (self.type, self.value)
Modified: kukit/kss.base/trunk/kss/base/selectors.txt
==============================================================================
--- kukit/kss.base/trunk/kss/base/selectors.txt (original)
+++ kukit/kss.base/trunk/kss/base/selectors.txt Sun Dec 2 16:04:40 2007
@@ -15,14 +15,7 @@
>>> Selector()
Traceback (most recent call last):
...
- Exception: Unimplemented
-
-XXX Jeroen, I removed the possibility for use an unregistered selector for
-two reasons:
-1. we need the type present on the class already.
-2. There is no code that possibly could use it anyway, so nothing
- could break for now.
-XXX Please delete this part to acknowledge...
+ NotImplementedError
Standard selectors
------------------
@@ -82,10 +75,9 @@
Selectors registered by plugins
-------------------------------
-Suppose a plugin registers a new selector. It must overwrite
-type, and __init__ (if it needs to have a value parameter).
-The type of the selector should always be in namespace-name
-notation. Only the core selectors stand without a namespace.
+Suppose a plugin registers a new selector. It must overwrite type, and
+__init__. The type of the selector should always be in namespace-name
+notation. Only the core selectors can do without a namespace.
>>> from kss.base.selectors import Selector
>>> class MyFunkySelector(Selector):
@@ -99,11 +91,9 @@
the registry. However, we test the registration somewhere
else, and just use the class as it is for now:
- >>> selector_class = MyFunkySelector
-
-Noe let's instantiate the selector:
+Now let's instantiate the selector:
- >>> selector = selector_class('Selector value')
+ >>> selector = MyFunkySelector('Selector value')
The selector now has a type and value property.
@@ -113,11 +103,9 @@
>>> selector.value
'Selector value'
-XXX Implementation remark:
-
- Currently only the "value" property will be considered to
- be marshalled to the client. So, selectors must have their
- parameter stored as "value" for now.
+Currently only the "value" property will be marshalled to the
+client. Selectors must therefore have their parameter stored as
+`value`.
String representation
@@ -125,8 +113,6 @@
For testing purposes we have a string representation of the selectors.
-!TODO: Fix lower casing of string representation
-
>>> print MyFunkySelector('value')
mynamespace-funky('value')
More information about the Kukit-checkins
mailing list