Back to index

plone3  3.1.7
kss.py
Go to the documentation of this file.
00001 from Acquisition import aq_inner
00002 
00003 from Products.CMFCore.utils import getToolByName
00004 from Products.Five.browser import BrowserView
00005 from Products.PythonScripts.standard import url_quote
00006 
00007 
00008 class KSSView(BrowserView):
00009     """ Information for kss rendering. """
00010 
00011     def registry(self):
00012         return getToolByName(aq_inner(self.context), 'portal_kss')
00013 
00014     def skinname(self):
00015         return self.context.getCurrentSkinName()
00016 
00017     def kineticstylesheets(self):
00018         registry = self.registry()
00019         registry_url = registry.absolute_url()
00020 
00021         kineticstylesheets = registry.getEvaluatedResources(self.context)
00022         skinname = url_quote(self.skinname())
00023         result = []
00024         for kss in kineticstylesheets:
00025             src = "%s/%s/%s" % (registry_url, skinname, kss.getId())
00026             data = {'src': src}
00027             result.append(data)
00028         return result