Commits

ajung committed d38bb37

adjusted to extented pp.core resources_registry API

Comments (0)

Files changed (3)

pp/client/plone/browser/pdf.py

 
 from pp.client.plone.logger import LOG
 from pp.core.transformation import Transformer
-from pp.core.resources_registry import resources_registry
+from pp.core.resources_registry import getResource
 
 from util import getLanguageForObject
 
     @property
     def resource(self):
         resource_id = self.request.get('resource', DEFAULT_RESOURCE)
-        if not resource_id in resources_registry:
+        try:
+            return getResource(resource_id)
+        except KeyError:
             raise KeyError(u'No resource "{}" registered'.format(resource_id))
-        return resources_registry[resource_id]
 
     def copyResourceFiles(self, destdir):
         """ Copy over resources for a global or local resources directory into the 

pp/client/plone/configure.zcml

     <include package="plone.browserlayer" />
 
     <include package="Products.CMFCore" file="permissions.zcml" />
+    <!--
     <include package="archetypes.schemaextender" />
-
     <adapter name="core-image-extender" factory=".extender.image.ImageExtender" />
     <adapter name="core-document-extender" factory=".extender.document.DocumentExtender" />
+    -->
 
     <include file="meta.zcml" />
     <include package=".browser" />

pp/client/plone/resources.py

-################################################################
-# pp.client-plone
-# (C) 2013,  ZOPYX Limited, D-72074 Tuebingen, Germany
-################################################################
-
-""" 
-Resources registry for templates, styles etc.
-"""
-
-import os
-from logger import  LOG
-
-# mapping name -> directory
-resources_registry = dict()
-
-def registerResource(name, directory):
-    if not os.path.exists(directory):
-        raise IOError('Directory "%s" does not exit' % directory)
-    resources_registry[name] = directory
-    LOG.info('Registered resource directory "%s" as "%s"' % (directory, name))