ExternalFile - Add: Create an ExternalFile object.

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.

Form Description

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.

Controls

Zope ID
The Zope ID of the ExternalFile object. Note: If you do not provide an ID then the leaf of the filepath (the file basename) will be used.
Title
The optional title of the ExternalFile object.
Description
The optional description of the ExternalFile object.
Target filepath on server
The file on the server that this ExternalFile instance will refer to. If the file does not already exist, it will be created (after confirmation).
Upload contents of local file
The file to (optionally) upload. Use the Browse... button to select a local file. The uploaded contents become the contents of the target file.
Add
Creates a new ExternalFile instance
Add and Edit
Creates a new ExternalFile instance and immediately jumps to the edit screen.
Target directory on server
Create ExternalFile instances from all files within this directory.
Include subfolders
Recursively descend into subdirectories.
Characters illegal in Zope URLs
A list of characters that are illegal in Zope object IDs. Zope objects will be created with the illegal characters automatically elided.
Omit directories with these names
Do not create Folder objects for directories with this name, nor descend into the directory recursively. Use this to omit, for example, CVS/ directories.
Omit directories with these prefixes
Use this, for example, to avoid "dot" directories such as .ssh or .gnome in UNIX.
'Omit directories with these suffixes
Omit directories with this suffix.
Omit files with these names
Omit files with these names.
Omit files with these prefixes
Omit files with the prefixes specified, for example "dot" files such as .bashrc
Omit files with these suffixes
Omit files with the suffixes specifies, for example emacs backup files