Skip to main content

UNKNOWN

Project description

Introduction

plone.resource publishes directories of static files via the ZPublisher. These directories may be located either in the ZODB (as OFS folders and files), or on the filesystem.

Each resource directory has a type and a name. When combined, these are used to traverse to the resource directory. For example:

/++theme++mytheme/<subpath>
/++sitelayout++mylayout/<subpath>
/++templatelayout++mylayout<subpath>

Where resources can be stored

Resource directory contents can be found by the traverser in several different places. The following locations are tried in order.

Files in the ZODB

Installing plone.resource creates a folder called portal_resources which can be used to store resource directories persistently. By convention, the top-level folders under this folder correspond to resource types, and the second-level folders correspond to the resource directory name.

So, the file traversable at /++theme++mytheme/myfile could be physically located at some_site/++etc++site/resources/theme/mytheme

(XXX: provide a helper to upload a tarball/zip)

Files in Python distributions

A folder in a Python distribution (e.g. egg) can be registered as a resource directory of a particular type and name using the plone:static ZCML directive. For example, this registers a directory named “theme” as a resource directory of type “theme”. It would be accessible at ++theme++mytheme:

<plone:static
  directory="theme"
  type="theme"
  name="mytheme"
  />

The name of the resource directory defaults to the name of the package, so can be omitted. e.g. the following directive in a package named “mytheme” would result in the same registration as above:

<plone:static
  directory="resources"
  type="theme"
  />

Traversing upward in directory paths using .. is not supported, as it could allow unwanted file access.

Files in a central resource directory

If the plone:static directive is used from site.zcml (i.e., with no active package in the ZCML import context), then it may specify the absolute path to a top-level resources directory. This should have the same subdirectory structure as the in-ZODB resources directory (i.e., top-level directories are resource types and 2nd-level directories are resource directory names).

For example, the following in site.zcml would register the path var/resources within the buildout root:

<plone:static

directory=”/path/to/buildout/var/resources” />

(Typically, this could be injected into site.zcml by specifying the zcml_additional option in the plone.recipe.zope2instance buildout recipe.)

What types of resources can be stored

Changelog

1.0b1 (2011-04-22)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone.resource-1.0b1.zip (42.7 kB view details)

Uploaded Source

File details

Details for the file plone.resource-1.0b1.zip.

File metadata

  • Download URL: plone.resource-1.0b1.zip
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for plone.resource-1.0b1.zip
Algorithm Hash digest
SHA256 dd6f18094ba7fc39ba8a6bd982b3dd5595034354130d51a46e3e9cf7eec8e975
MD5 3962a4a199b19e974f6dfb968a0f47a4
BLAKE2b-256 bdae39490447abba26a35063983d2ba2e5d67dcea89df8f682300d219ce98280

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page