[KSS-checkins] r44331 - in kukit/kss.core/trunk: docs kss/core kss/core/plugins/core
reebalazs at codespeak.net
reebalazs at codespeak.net
Mon Jun 18 11:58:31 CEST 2007
Author: reebalazs
Date: Mon Jun 18 11:58:31 2007
New Revision: 44331
Modified:
kukit/kss.core/trunk/docs/HISTORY.txt
kukit/kss.core/trunk/kss/core/deprecated.py
kukit/kss.core/trunk/kss/core/plugins/core/commands.py
kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml
kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py
Log:
addClassName.>addClass, removeClassName->removeClass name changes. They and toggleClass all take a 'name' parameter.
- added proper BBB
- also fixed the getSameNodeSelector on the core commandset, which was broken.
XXX: problem is, addClass and removeClass have unsatisfied
dependency, so they are broken in kss. Currently work with Plone 3.
Modified: kukit/kss.core/trunk/docs/HISTORY.txt
==============================================================================
--- kukit/kss.core/trunk/docs/HISTORY.txt (original)
+++ kukit/kss.core/trunk/docs/HISTORY.txt Mon Jun 18 11:58:31 2007
@@ -6,6 +6,13 @@
- ...
+ - Deprecated addClassName, removeClassName actions and
+ commands in favour of addClass and removeClass.
+ Deprecated "name" and "classname" parameter in addClass,
+ removeClass, toggleClass actions and commands in favour of
+ "value".
+ [ree]
+
- implement new packing directives and two disctint
versions of the javascript (development and production),
this is achieved from javascript with the ;;; marker
Modified: kukit/kss.core/trunk/kss/core/deprecated.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/deprecated.py (original)
+++ kukit/kss.core/trunk/kss/core/deprecated.py Mon Jun 18 11:58:31 2007
@@ -18,6 +18,9 @@
import warnings, textwrap
+def deprecated_warning(message):
+ warnings.warn(message, DeprecationWarning, 2)
+
def deprecated(method, message):
def deprecated_method(self, *args, **kw):
warnings.warn(message, DeprecationWarning, 2)
Modified: kukit/kss.core/trunk/kss/core/plugins/core/commands.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/plugins/core/commands.py (original)
+++ kukit/kss.core/trunk/kss/core/plugins/core/commands.py Mon Jun 18 11:58:31 2007
@@ -1,7 +1,7 @@
from kss.core.selectors import Selector, CssSelector, HtmlIdSelector
from kss.core.selectors import ParentNodeSelector, SameNodeSelector
from kss.core.kssview import CommandSet
-from kss.core.deprecated import deprecated
+from kss.core.deprecated import deprecated, deprecated_warning
from kss.core.parsers import HtmlParser
from kss.core.plugins.core.interfaces import IKSSCoreCommands
from zope.interface import implements
@@ -19,8 +19,8 @@
def getHtmlIdSelector(self, selector):
return HtmlIdSelector(selector)
- def getSameNodeSelector(self, selector):
- return SameNodeSelector(selector)
+ def getSameNodeSelector(self):
+ return SameNodeSelector()
def getParentNodeSelector(self, selector):
return ParentNodeSelector(selector)
@@ -130,20 +130,32 @@
for key, value in kw.iteritems():
command.addParam(key, value)
- def toggleClass(self, selector, classname):
+ def toggleClass(self, selector, *arg, **kw):
+ ##def toggleClass(self, selector, value):
""" see interfaces.py """
+ # BBB 4 months, until 2007-10-18
+ value = BBB_classParms('toggleClass', *arg, **kw)
+
command = self.commands.addCommand('toggleClass', selector)
- data = command.addParam('classname', classname)
+ data = command.addParam('value', value)
- def addClassName(self, selector, name):
+ def addClass(self, selector, *arg, **kw):
+ ##def addClass(self, selector, name):
""" see interfaces.py """
- command = self.commands.addCommand('addClassName', selector)
- data = command.addParam('name', name)
+ # BBB 4 months, until 2007-10-18
+ value = BBB_classParms('addClass', *arg, **kw)
+
+ command = self.commands.addCommand('addClass', selector)
+ data = command.addParam('value', value)
- def removeClassName(self, selector, name):
+ def removeClass(self, selector, *arg, **kw):
+ ##def removeClass(self, selector, name):
""" see interfaces.py """
- command = self.commands.addCommand('removeClassName', selector)
- data = command.addParam('name', name)
+ # BBB 4 months, until 2007-10-18
+ value = BBB_classParms('removeClass', *arg, **kw)
+
+ command = self.commands.addCommand('removeClass', selector)
+ data = command.addParam('value', value)
def focus(self, selector):
""" see interfaces.py """
@@ -151,12 +163,14 @@
# XXX Deprecated ones
+ # BBB until 2007-10-18
def moveChildrenTo(self, selector, id):
""" see interfaces.py """
self.copyChildrenTo(selector, id)
self.clearChildren(selector)
moveChildrenTo = deprecated(moveChildrenTo, 'No more supported, use a sequence of copyChildrenTo and clearChildren')
+ # BBB until 2007-10-18
setHtmlAsChild = deprecated(replaceInnerHTML, 'use replaceInnerHTML instead')
addAfter = deprecated(insertHTMLAfter, 'use insertHTMLAfter instead')
clearChildren = deprecated(clearChildNodes, 'use clearChildNodes instead')
@@ -167,4 +181,24 @@
copyChildrenTo = deprecated(copyChildNodesTo, 'use copyChildNodesTo instead')
setStatevar = deprecated(setStateVar, 'use setStateVar (capital V) instead')
+ # BBB 4 month, until 2007-10-18
+ addClassName = deprecated(addClass, 'use addClass instead')
+ removeClassName = deprecated(removeClass, 'use removeClass instead')
+
+# BBB 4 month, until 2007-10-18
+def BBB_classParms(commandname, value=None, classname=None, name=None):
+ if classname:
+ deprecated_warning(('Deprecated the "classname" parameter in the "%s" command, ' +
+ 'use "name" instead.') % (commandname ,))
+ if not value:
+ value = classname
+ if name:
+ deprecated_warning(('Deprecated the "name" parameter in the "%s" command, ' +
+ 'use "name" instead.') % (commandname ,))
+ if not value:
+ value = name
+ if not value:
+ raise Exception, 'Parameter "value" is mandatory in command "%s"' % (commandname, )
+ return value
+
# end deprecated
Modified: kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml
==============================================================================
--- kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml (original)
+++ kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml Mon Jun 18 11:58:31 2007
@@ -252,19 +252,19 @@
<kss:action
name="toggleClass"
command_factory="selector"
- params_mandatory="classname"
+ params_mandatory="value"
/>
<kss:action
- name="addClassName"
+ name="addClass"
command_factory="selector"
- params_mandatory="name"
+ params_mandatory="value"
/>
<kss:action
- name="removeClassName"
+ name="removeClass"
command_factory="selector"
- params_mandatory="name"
+ params_mandatory="value"
/>
<kss:action
Modified: kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py (original)
+++ kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py Mon Jun 18 11:58:31 2007
@@ -80,16 +80,16 @@
"""Trigger an event on the client """
# TODO: explain a bit better what this does
- def toggleClass(selector, classname):
+ def toggleClass(selector, value):
"""Add/remove a class to/from a node.
If the class is present it will be removed. Else the class will be
added. """
- def addClassName(selector, name):
+ def addClass(selector, value):
"""Add a class to a node."""
- def removeClassName(selector, name):
+ def removeClass(selector, value):
"""Remove a class from a node."""
def focus(selector):
More information about the Kukit-checkins
mailing list