Plone 4.3 is installed at c:\Plone43 directory with the site.zcml located in c:\Plone43\parts\instance\etc\site.zcml
All I want to do is setup a directory where I can put some images or resources and be able to access them using a URL like http://wiki.mycompany.net:8080/++resources++PROJECTNAME/images/someimage.png
I have activated the plone.resource 1.0.2 but have no idea where to put any images now or how to configure it. I have heard people talking about zcml but I have no idea what zcml file they are talking about.
I added the line in the site.zcml and then the plone site would not come up so I had to remove it.
Can someone please help me configure a static resource folder please? I am ok to configure a global one directly in the site.zcml if its possible.
Current site.zcml looks like this:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta"
xmlns:five="http://namespaces.zope.org/five">
<include package="Products.Five" />
<meta:redefinePermission from="zope2.Public" to="zope.Public" />
<!-- Load the meta -->
<include files="package-includes/*-meta.zcml" />
<five:loadProducts file="meta.zcml"/>
<!-- Load the configuration -->
<include files="package-includes/*-configure.zcml" />
<five:loadProducts />
<!-- Load the configuration overrides-->
<includeOverrides files="package-includes/*-overrides.zcml" />
<five:loadProductsOverrides />
<securityPolicy
component="AccessControl.security.SecurityPolicy" />
</configure>
Forget about site.zcml; just create an small add-on package that has (1) a directory for your static resources, (2) a configure.zcml file using a browser:resourceDirectory declaration. Put your add-on in source control somewhere.
Your package should set up the following structure (assumes UNIX, you can easily translate this to Windows equivalents as you see fit, rename package appropriately):
~/my-buildout $ cd src
~/my-buildout/src $ mkdir -p myorg.packagename/myorg/packagename/static
~/my-buildout/src $ cd myorg.packagename
~/my-buildout/src/myorg.packagename $ vim setup.py # edit as needed
... # see http://docs.python.org/2/distutils/setupscript.html
~/my-buildout/src/myorg.packagename $ vim myorg/__init__.py
Make your namespace package work (in myorg/__init__.py):
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
Other boilerplate:
~/my-buildout/src/myorg.packagename $ echo "#" > myorg/packagename/__init__.py
~/my-buildout/src/myorg.packagename $ vim myorg/packagename/configure.zcml
Your configure.zcml should look like:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<browser:resourceDirectory
name="MYPROJECTNAME"
directory="static"
/>
</configure>
Installing add-ons is well-documented for Plone, so I am omitting description of that.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句