跳转到主要内容

一个为Archetypes提供额外存储的Plone插件产品。

项目描述

关于

ExternalStorage 是一个用于存储Archetypes字段的存储,存储内容在ZODB之外。因此,它的工作方式类似于ExternalFile或类似产品。

用法

只需在模式中定义您的字段存储之一为 ExternalStorage 即可。(见 examples/ 中的 ExternalExample)。

示例

将 examples/ExternalExample 复制到您的 Products 目录中。

定义自定义路径策略

您可以为您的类提供一个自己的路径策略,只需在类中编写一个名为 'getExternalPath' 的方法(或在初始化存储时在 'path_method' 中指定的任何其他内容)。

一些常见用途包括

  1. 实例相对于当前门户的路径(默认):path = portal_url.getRelativeContentURL(instance)

  2. 实例绝对路径,包括门户名称和所有上述路径 = ‘/’.join(instance.getPhysicalPath())

  3. 平铺实例 UID 路径 = instance(UID())

  4. 按 Portal 类型排序的路径 = instance.getTypeInfo().getId() + ‘/’ + instance.getId()

默认情况下,文件将根据策略(1)存储。如果类有多个字段,则(1)将是一个文件夹,文件将存储在其中,按字段名称排序。

请注意,在提供自定义路径策略时,请提供支持多个字段的额外代码。

存档

在某些早期版本中存在某种存档支持。这是通过在某些特殊文件夹中复制旧内容实现的。

它已从当前版本中删除,但将来会重新添加。

变更日志

0.8 - 05/11/2011

  • Plone 4 兼容 [davisagli, maurits, SteveM]

  • 包清理和发布 [aclark]

历史

  • 2004-2009:

    2009-11-01  Maurits van Rees <m.van.rees@zestsoftware.nl>
    
        * interfaces/externalstorage.py: Removed import that breaks Plone
        4 and is unused anyway.
    
    2008-05-04  Steve McMahon <steve@dcn.org>
    
        * Fixed example product to import permissions from CMFCore.permissions
        so that tests will run under Plone 3.0. Many tests failing, but
        this doesn't look new (91 tests with 20 failures and 2 errors).
    
    2007-11-25  Dorneles Treméa  <deo@plonesolutions.com>
    
        * utils.py, config.py, ExternalStorage.py: Removed our half baked
        cleanupFilename method and replaced it with the one from ATContentTypes.
    
        * tests/framework.py, tests/runalltests.py: Removed.
    
        * tests/testAdd.py, tests/testContentType.py, tests/testCut.py,
        tests/testEdit.py, tests/testFilename.py, tests/testImageField.py,
        tests/testRename.py, tests/testArchive.py, tests/testCopy.py,
        tests/testDelete.py, tests/testExternalStorage.py,
        tests/testFunctional.py, tests/testMultiField.py: Removed the old test
        framework infrastructure in favor of the modern './bin/zopectl test'
        approach.
    
        * config.py, tests/testRename.py: Removed the unnecessary IS_PLONE_2_0
        flag, changing tests to use a basic API call (manage_renameObject).
    
        * tests/testRename.py: Renamed some tests and added a new one,
        testOldFolderRemovedFromFileSystem, which currently is failing.
    
    2007-02-16  Jean-Paul Ladage <j.ladage@zestsoftware.nl>
    
        * ExternalStorage.py: Use normalizeString from plone_utils to make
        filenames os compatible. (Didn't remove the util.cleanupFilename method
        yet. Also let ES play nicer with image fields by using shutil.rmtree in
        the cleanupField method.
    
    2006-09-22  Martijn Pieters <mj@zopatista.com>
    
        * ExternalStorage.py: Extend filesystem path generation to use
        directories when a ImageField with scales is used. Also made detection
        of the image-scale case robuster.
    
        * example/ExternalExample/__init__.py,
        example/ExternalExample/ExternalImage.py: Example type using an
        ImageField.
    
        * tests/ESTestCase.py, tests/testImageField.py, tests/data/sample.png:
        Tests for ImageField cases.
    
    2006-09-21  Martijn Pieters <mj@zopatista.com>
    
        * tests/ESTestCase.py: Switched to newstyle transaction savepoints,
        cleaned up test-file loading.
    
        * utils.py: Replaced zLOG with the python logging module
    
        * filewrapper.py, ExternalStorage.py: Added support for ImageFields by
        telling the file wrapper what content class to use based on the field.
        Includes support for scaling images.
    
    2005-10-25  Dorneles Treméa  <deo@plonesolutions.com>
    
        * filewrapper: Made sure to not break when mimetype is None.
        This should fix the migration from old instances and also WebDAV
        renames.
    
    2005-10-09  Dorneles Treméa  <deo@plonesolutions.com>
    
        * config.py: Added code to check for CMFPlone version.
    
        * tests/testRename.py: Fixed compatibility with CMFPlone 2.1.
    
        * README, TODO, AUTHORS: Added '.txt' extension.
    
        * version.txt: Bumpped version to 0.7
    
    2005-06-01  Dorneles Treméa  <deo@plonesolutions.com>
    
        * ExternalStorage.py: Restored compatibility with Archetypes after
        the large-file fixes. An Archetypes version *after* 1.3.3-final is
        now officialy required.
    
        * README: Added note about the new Archetypes version required.
    
        * tests/testAdd.py, tests/testMultiField.py, tests/testFunctional.py,
        tests/testEdit.py, tests/testRename.py: Updated tests to the new
        internal format.
    
        * version.txt: Bumpped version to 0.6
    
    2005-04-01  Dorneles Treméa  <deo@plonesolutions.com>
    
        * ExternalStorage.py: Added a completely rewrote version supporting
        schemas defining multiple fields with ExternalStorage as storage.
        Removed the archive support for now. Added support to specify the
        filesystem path through a flexible way.
    
        * filewrapper.py: Added a file wrapper class to provide some nice
        features. Thanks to Tiran for the original idea.
    
        * tests/testAdd.py, tests/dummy.py, tests/testCut.py,
        tests/testFunctional.py, tests/ESTestCase.py, tests/testRename.py,
        tests/testCopy.py, tests/testEdit.py: Fixed some tests to the new
        implementation.
    
        * tests/testMultiField.py: Added to test the new multiple fields
        support.
    
        * tests/data/sample.zip: Replaced by another file, different from
        the 'sample (chars).zip' one.
    
        * README: Added note about path policy and archive.
    
        * example/ExternalExample/ComplexSample.py: Added to demonstrate
        the multifield support.
    
        * AUTHORS: Added note about code rewrite.
    
        * TODO: Removed finished items. Added new ones... ;-)
    
        * FileUtils.py: Removed. No more foreign code.
    
        * LICENSE.txt: Added as BSD license.
    
        * version.txt: Bumpped version to 0.5
    
    2005-03-08  Dorneles Treméa  <deo@plonesolutions.com>
    
        * ExternalStorage.py (__init__, initializeInstance, unset): Fixed
        a bug when an operation of copy/cut/rename is performed on multiple
        files at same time. Thanks to Sam Stainsby.
    
        * tests/testRename.py: Added a second ExternalArticle instance to
        tests, so we can demonstrate the multiple copy/cut/rename bug.
    
        * tests/testAddChars.py, tests/testEditChars.py: Removed. Fixed
        tests and merged the important stuff into testAdd.py and testEdit.py
        files.
    
    2005-01-18  Nate Aune  <natea@jazkarta.com>
    
        * config.py: Added GOOD_CHARS and CHAR_MAPPING constant tables.
    
        * ExternalStorage.py (cleanupFilename): Added a method to map
        illegal chars to allowed ones, so we can avoid ZopeCopyError
        exceptions.
    
        * tests/testAddChars.py, tests/testEditChars.py: Added tests to
        make sure ES supports files with special characters (tests are
        currently failing).
    
    2005-01-17  Dorneles Treméa  <deo@plonesolutions.com>
    
        * tests/ESTestCase.py, tests/testFunctional.py: Added
        FunctionalTestCase class and tests (currently failing).
    
        * example/ExternalExample/ExternalArticle.py: Renamed 'file' to
        'stream' to avoid a name clash. Added a 'normal_file' field for
        test propose.
    
    2005-01-10  Dorneles Treméa  <deo@plonesolutions.com>
    
        * tests/testAdd.py: Added TestMultipleAddFile testsuite.
    
        * tests/ESTestCase.py (_addFileByFileUpload): Changed to use the
        newly added DATAPATH instead of a fixed one.
    
        * ExternalStorage.py (initializeInstance, set): Fixed a bug when
        creating multiple files using ExternalStorage: the last created
        file was created with the content from the previous one.
    
    2005-01-09  Dorneles Treméa  <deo@plonesolutions.com>
    
        * TODO: Removed the finished 'rename' item.
    
        * tests/testAdd.py: Replaced docstring by comment.
    
        * tests/testEdit.py: Added tests for the file rename process on
        field edit.
    
        * example/ExternalExample/ExternalArticle.py (setFile): Removed
        method, now that rename-on-upload works.
    
        * ExternalStorage.py (initializeInstance): Changed to only create
        the archive when required.
        (set): Made the rename process works when uploading a file with a
        different name.
        (getBasePath, computeFilePath): Fixed to always return a normalized
        path.
    
    2004-12-08  Dorneles Treméa  <deo@plonesolutions.com>
    
        * ChangeLog, HISTORY: Added a change log file and removed the old
        history one.
    
        * TODO: Updated note about 'rename'. Added an entry for file
        stream iterator tests.
    
        * example/ExternalExample/ExternalArticle.py: Moved primary and
        required from 'body' to 'file' field. Added 'rename' parameter to
        ExternalStorage.
    
        * tests/ESTestCase.py: Changed to use a different path based on
        ENVIRONMENT_VARIABLE, so tests doesn't remove anything by accident.
    
        * tests/testAdd.py, tests/testContentType.py, tests/testCopy.py,
        tests/testCut.py, tests/testDelete.py, tests/testExternalStorage.py,
        tests/testFilename.py, tests/testRename.py: Splitted into different
        modules. Added filename/contenttype/delete test suites.
    
        * ExternalStorage.py: Reorganized code. Fixed the cleanup of
        filesystem garbage when deleting/moving/renaming objects at ZODB.
        Fixed to return the same content that was stored: StringType or File,
        and thus the correct filename/contenttype. Added initial code for the
        'rename' behavior. Renamed _extstorage_* variables to _es_*.
    
    2004-11-30  Dorneles Treméa  <deo@plonesolutions.com>
    
        * tests/: ESTestCase.py, testArchive.py, testExternalStorage.py:
        Added multi-field support to tests.
    
    2004-11-29  Dorneles Treméa  <deo@plonesolutions.com>
    
        * tests/: testExternalStorage.py, ESTestCase.py: Renamed constants
        for better understanding. Added test for the parent folder rename.
    
    2004-11-26  Dorneles Treméa  <deo@plonesolutions.com>
    
        * TODO: Updated TODO list. Next features comming soon... ;-)
    
        * ExternalStorage.py: Fixed rename process: cleanupField != unset.
        Fixed mimetype/filename support. Standardized variable names.
        Renamed some private methods.
    
        * AUTHORS, Makefile, config.py, version.txt: Added config/makefile.
        Updated version/authors.
    
        * tests/: ESTestCase.py, testExternalStorage.py: Added tests for
        ContentType/Filename. Implemented testTitleChanged.
    
        * tests/testArchive.py: Added stub file for Archive tests.
    
        * FileUtils.py, example/ExternalExample/ExternalArticle.py,
        example/ExternalExample/StreamingFile.py: Cleaned up whitespaces.
    
        * tests/data/sample.zip: Added a ZIP sample file.
    
        * iexternalstorage.py, interfaces/__init__.py,
        interfaces/externalstorage.py: Added interfaces package.
    
    2004-10-20  Dorneles Treméa  <deo@plonesolutions.com>
    
        * tests/: ESTestCase.py, dummy.py, testExternalStorage.py: Rewrote
        tests. More to come... ;-)
    
        * AUTHORS, ExternalStorage.py, HISTORY, TODO, iexternalstorage.py:
        Cleaned up code.
    
    2004-10-15  Christian Scholz  <cs@comlounge.net>
    
        * iexternalstorage.py: Changed import of Interface to make it work
        again with recent AT.
    
    2004-09-05  Christian Scholz  <cs@comlounge.net>
    
        * ExternalStorage.py: Fixed unset() for deleting files.
    
    2004-08-31  Christian Scholz  <cs@comlounge.net>
    
        * example/ExternalExample/: ExternalArticle.py, StreamingFile.py:
        Example now using FileStream iterator.
    
        * ExternalStorage.py, tests/ESTestCase.py,
        tests/testExternalStorage.py: Copying/moving now working.
        FileStream iterator can be used (see example).
    
    2004-06-28  Christian Scholz  <cs@comlounge.net>
    
        * tests/ESTestCase.py: No clearance of data anymore right now.
    
    2004-06-27  Christian Scholz  <cs@comlounge.net>
    
        * ExternalStorage.py: Paths are now stored relative. Tried to make
        it backwards compatible.
    
        * tests/testExternalStorage.py: Tests are also working now ;-)
    
        * tests/: ESTestCase.py, __init__.py, dummy.py, framework.py,
        runalltests.py, testExternalStorage.py, data/test.doc: First try
        on adding tests.
    
    2004-05-22  Christian Scholz  <cs@comlounge.net>
    
        * example/ExternalExample/ExternalArticle.py: Made docstring for
        setFile() more verbose.
    
        * example/ExternalExample/ExternalArticle.py: Added example for
        automatically renaming the object to the filename of the uploaded
        field.
    
        * ExternalStorage.py: Fixed the "file data removed after object
        rename" bug and changed the log level from INFO to DEBUG.
    
    2004-05-05  Christian Heimes  <heimes@faho.rwth-aachen.de>
    
        * ExternalStorage.py: Added disable archive feature.
    
    2004-04-24  Christian Heimes  <heimes@faho.rwth-aachen.de>
    
        * ExternalStorage.py: Changed tab to spaces. Added fixes to the
        set() method.
    
    2004-04-14  Christian Scholz  <cs@comlounge.net>
    
        * ExternalStorage.py, HISTORY, TODO,
        example/ExternalExample/ExternalArticle.py: viewing of external
        files now actually works:
    
          - content type is stored - content type can be retrieved
          - ExternalExample now has some example methods for retrieving
            the contents of the file.
    
    2004-03-05  Christian Scholz  <cs@comlounge.net>
    
        * AUTHORS, ExternalStorage.py, FileUtils.py, HISTORY, README, TODO,
        __init__.py, iexternalstorage.py, refresh.txt, version.txt,
        example/ExternalExample/ExternalArticle.py,
        example/ExternalExample/README,
        example/ExternalExample/__init__.py,
        example/ExternalExample/config.py,
        example/ExternalExample/refresh.txt,
        example/ExternalExample/Extensions/Install.py,
        example/ExternalExample/skins/externalexample/article_view.pt:
        Initial import.

原作者

Christian Scholz (cs@comlounge.net, MrTopf @ freenode.net) http://comlounge.net

维护者 / 代码重写 / 测试 / 错误修复

Dorneles Treméa (deo@plonesolutions.com, deo @ freenode.net) http://plonesolutions.com

维护

Alex Clark (aclark@aclark.net) http://aclark.net

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源代码分发

Products.ExternalStorage-0.8.1.zip (62.5 kB 查看散列)

上传时间 源代码

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面