ExternalFile encapsulates a file in the filesystem for use as a Zope object. The filesystem must be locally accessible to the Zope server. The metadata associated with the ExternalFile is stored in the Zope object database, but the content itself is not. When the content of an ExternalFile is accessed by Zope, it is automatically retrieved from the filesystem. An ExternalFile always points to a file that exists locally on the server. That file may be:
By default, the ExternalFile instance will behave like a DTMLDocument for html or dtml code, an Image for jpg, or gif, and a File for binary and proprietary-format files. The behave_like feature can be later modified using the Properties tab. See README.txt for a detailed explanation of mimetypes, displaytypes, and behave_like.
ExternalFile is like an UNIX alias or windows shortcut. That is, it merely points to an external file. Therefore, it is possible to have multiple ExternalFile objects in Zope all pointing to the same physical file on the filesystem, but with (possibly) different Zope metadata.
Creates a new instance of ExternalFile that refers to a file in the filesystem, or an entire batch of ExternalFile instances: one for every file in the directory indicated.
In either the singleton or batch case, the file/directory must be one that is visible to the Zope server i.e. local or network mounted.
Batches can be recursive or not. If the descend subdirectories
option is not checked, the batch will not be recursive, and this
function will only create instances for files that are directly
inside the target directory, not any of its subdirectories.
If the descend subdirectories
option is checked, the function
will create instances of Zope folders for each subdirectory, and
instances of ExternalFile for each file in the top level directory
and all of its subdirectories. It is pretty fast, but may take
some time for batches of greater than 1000 files.
In the batch case, for each file found in the directory in
question, an instance of ExternalFile will be created whose ID
property is equal to the leaf of the filepath. For example:
File: /foo/bar/blat/example.txt ID: example.txt
Some files may have characters in their names that would be
illegal in a Zope ID
. These characters are filtered out
automatically. For example:
File: /tmp/@.DCOP_baryshnikov:1 ID: .DCOP_baryshnikov1
In the case of creating a batch, the form includes a set of filters for omitting files. These are handy to avoid obviously inappropriate things such as system files or CVS control files, or simply to customize your batch.
The batch creation function is robust enough such that files that correspond to already existing Zope IDs are simply skipped. That means that you can accomplish a poor man's version of LocalFS (which automatically recognizes new files and folders within a filesystem) by periodically reloading from the same directory.
Zope ID
Title
Description
Target filepath on server
Upload contents of local file
Browse...
button to select a local file.
The uploaded contents become the contents of the target file.Add
Add and Edit
Target directory on server
Include subfolders
Characters illegal in Zope URLs
Omit directories with these names
Omit directories with these prefixes
Omit files with these names
Omit files with these prefixes
Omit files with these suffixes