Author: jvloothuis
Date: Fri May 2 18:04:55 2008
New Revision: 54339
Modified:
kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/bbb/commandset.py
kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.py
kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.txt
Log:
Made adjustments for the changes in the grokkerdam branch of kss.base
Modified:
kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/bbb/commandset.py
==============================================================================
--- kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/bbb/commandset.py
(original)
+++ kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/bbb/commandset.py
Fri May 2 18:04:55 2008
@@ -1,12 +1,26 @@
+#from deprecated import deprecated
+
+from kss.base import core
-# BBB selector compat wrapper
from kss.zope.commandset import ZopeCommandSet
-from kss.base.corecommands import KSSCoreCommands
-##from deprecated import deprecated
-when = 'after 2008-08-01'
+class CommandWrapper(object):
+ def __init__(self, command, commands):
+ self.command = command
+ self.commands = commands
+
+ def __call__(self, *args, **kwargs):
+ self.command(self.commands, *args, **kwargs)
+
+# BBB core command compat
+class KSSCoreCommands(ZopeCommandSet):
+ def __getattr__(self, name):
+ return CommandWrapper(getattr(core, name), self.commands)
-class CompatCommandSet(ZopeCommandSet, KSSCoreCommands):
+
+# BBB selector compat wrapper
+pwhen = 'after 2008-08-01'
+class CompatCommandSet(KSSCoreCommands):
## Don't BBB yet. Uncommenting the next line will activate BBB.
[EMAIL PROTECTED]('use getattr(view.selectors, type)(value) instead', when)
Modified: kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.py
==============================================================================
--- kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.py
(original)
+++ kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.py Fri May
2 18:04:55 2008
@@ -2,8 +2,9 @@
from kss.base.plugin import available_plugins
from kss.zope.interfaces import IKSSPluginRegistry
-# BBB registries for configuration of plugins through ZCML
-BBB_commandsets = {}
+# BBB registries for configuration of plugins through ZCML etc.
+from kss.zope.bbb.commandset import KSSCoreCommands
+BBB_commandsets = {'core': KSSCoreCommands}
BBB_javascripts = []
class GlobalPluginRegistry(object):
@@ -65,8 +66,8 @@
return self._extra_javascripts
def lookup_commandset(self, id):
- commandsets = BBB_commandsets.copy()
- commandsets.update(self._commandsets)
+ commandsets = dict(self._commandsets)
+ commandsets.update(BBB_commandsets.copy())
return commandsets[id]
def lookup_selector(self, id):
Modified: kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.txt
==============================================================================
--- kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.txt
(original)
+++ kukit/kss.zope/branches/grokkerdam-api-tweaks/kss/zope/registry.txt Fri May
2 18:04:55 2008
@@ -58,7 +58,7 @@
Loading the commandset for the core should be possible.
>>> registry.lookup_commandset('core')
- <class 'kss.base.corecommands.KSSCoreCommands'>
+ <class '...KSSCoreCommands'>
As you can see it returns a factory (in this case the class) for the
commandset.
@@ -105,8 +105,8 @@
registration is a simple call to the registry with a commandset
factory.
- >>> from kss.base.commands import KSSCommandSet
- >>> class CheeseCommandSet(KSSCommandSet):
+ >>> from kss.zope.commandset import ZopeCommandSet
+ >>> class CheeseCommandSet(ZopeCommandSet):
... pass
>>> BBB_register_commandset('cheese', CheeseCommandSet)
>>> registry.lookup_commandset('cheese')
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins