[KSS-checkins] r49283 - kukit/kss.zope/trunk/kss/zope
reebalazs at codespeak.net
reebalazs at codespeak.net
Sun Dec 2 16:03:34 CET 2007
Author: reebalazs
Date: Sun Dec 2 16:03:34 2007
New Revision: 49283
Modified:
kukit/kss.zope/trunk/kss/zope/commandset.py
kukit/kss.zope/trunk/kss/zope/registry.py
kukit/kss.zope/trunk/kss/zope/registry.txt
Log:
Add lookup_selector implementation to registry
Modified: kukit/kss.zope/trunk/kss/zope/commandset.py
==============================================================================
--- kukit/kss.zope/trunk/kss/zope/commandset.py (original)
+++ kukit/kss.zope/trunk/kss/zope/commandset.py Sun Dec 2 16:03:34 2007
@@ -1,5 +1,5 @@
from zope import interface
-from kss.base.coreselectors import htmlid, css
+from kss.base.selectors import htmlid, css
from kss.base.corecommands import KSSCoreCommands
from kss.zope.interfaces import IZopeCommandSet
Modified: kukit/kss.zope/trunk/kss/zope/registry.py
==============================================================================
--- kukit/kss.zope/trunk/kss/zope/registry.py (original)
+++ kukit/kss.zope/trunk/kss/zope/registry.py Sun Dec 2 16:03:34 2007
@@ -12,18 +12,29 @@
def __init__(self):
self._commandsets = {}
- for plugin_id, config in available_plugins():
- self._commandsets.update(config.commandsets)
-
self._javascripts = []
+ self._extra_javascripts = []
+ self._selectors = {}
+
+ # Import information from all available plugins,
+ # and make them availeble on the level of Zope.
for id, config in self.plugins():
+ # get commandset info
+ self._commandsets.update(config.commandsets)
+ # get javascripts info
for javascript in config.javascripts:
self._javascripts.append(javascript)
-
- self._extra_javascripts = []
- for id, config in self.plugins():
+ # get extra javascripts info
for extra_javascript in config.extra_javascripts:
self._extra_javascripts.append(extra_javascript)
+ # get selectors info
+ # XXX TODO We would really like to use selectors[name]
+ # lookup directly from kss.base... and then we won't need
+ # this storage. However kss.base does not offer this
+ # information, only for activated plugins.
+ for selectors in config.selectors.itervalues():
+ for selector in selectors:
+ self._selectors[selector.type] = selector
def plugins(self):
return available_plugins()
@@ -39,6 +50,13 @@
commandsets.update(self._commandsets)
return commandsets[id]
+ def lookup_selector(self, id):
+ # XXX it would be nice to have:
+ # from kss.base import selectors
+ # return selectors[id]
+ # or something similar.
+ return self._selectors[id]
+
#=============================================
# Stuff needed for compatibility features
#=============================================
Modified: kukit/kss.zope/trunk/kss/zope/registry.txt
==============================================================================
--- kukit/kss.zope/trunk/kss/zope/registry.txt (original)
+++ kukit/kss.zope/trunk/kss/zope/registry.txt Sun Dec 2 16:03:34 2007
@@ -69,7 +69,7 @@
A given selector class can be queried as well:
>>> registry.lookup_selector('css')
- <class 'kss.base.coreselectors.css'>
+ <class 'kss.base.selectors.css'>
BBB
More information about the Kukit-checkins
mailing list