Back to index

plone3  3.1.7
registry.py
Go to the documentation of this file.
00001 # Copyright (c) 2005-2007
00002 # Authors: KSS Project Contributors (see docs/CREDITS.txt)
00003 #
00004 # This program is free software; you can redistribute it and/or modify
00005 # it under the terms of the GNU General Public License version 2 as published
00006 # by the Free Software Foundation.
00007 #
00008 # This program is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 # GNU General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU General Public License
00014 # along with this program; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00016 # 02111-1307, USA.
00017 
00018 import zope.component as capi
00019 from interfaces import IKSSPlugin
00020 from zope.interface import implements
00021 # concatresource is an embedded product 
00022 import _concatresource
00023 from concatresource.interfaces import IConcatResourceAddon
00024 from json import getJsonAddonFiles
00025 import zope.component as capi
00026 
00027 class KSSConcatResourceAddon(object):
00028     implements(IConcatResourceAddon)
00029     
00030     def getAddonFiles(self):
00031         try:
00032             files = self._addon_files
00033         except AttributeError:
00034             # Lazy setup of addon files
00035             self._addon_files = files = getJsonAddonFiles()
00036             # Lookup all utilities and add up the files from it
00037             plugins = capi.getAllUtilitiesRegisteredFor(IKSSPlugin)
00038             for plugin in plugins:
00039                 if plugin.jsfile and plugin.jsfile not in files:
00040                     files.append(plugin.jsfile)
00041         return files
00042 
00043 kssConcatResourceAddon = KSSConcatResourceAddon()