{"id":23019,"library":"zope-filerepresentation","title":"zope.filerepresentation","description":"Provides interfaces and utilities for representing filesystem objects (files, directories) in Zope applications. Version 7.0 requires Python >=3.9. Maintenance release cadence is low; updates occur as needed.","status":"active","version":"7.0","language":"python","source_language":"en","source_url":"https://github.com/zopefoundation/zope.filerepresentation","tags":["zope","file-representation","interfaces","zope-filerepresentation"],"install":[{"cmd":"pip install zope.filerepresentation","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for interface definitions","package":"zope.interface","optional":false},{"reason":"Required for field definitions in interfaces","package":"zope.schema","optional":false}],"imports":[{"note":"IFileFactory is defined in the interfaces submodule.","wrong":"from zope.filerepresentation import IFileFactory","symbol":"IFileFactory","correct":"from zope.filerepresentation.interfaces import IFileFactory"},{"note":"readFile is a module-level utility function, not an interface.","wrong":"from zope.filerepresentation.interfaces import readFile","symbol":"readFile","correct":"from zope.filerepresentation import readFile"}],"quickstart":{"code":"from zope.filerepresentation.interfaces import IFileFactory\nfrom zope.interface import directlyProvides\n\nclass MyFileFactory:\n    def __call__(self, name, data):\n        return {'name': name, 'data': data}\n\ndirectlyProvides(MyFileFactory, IFileFactory)\n\ndef test_factory():\n    factory = MyFileFactory()\n    result = factory('test.txt', b'hello')\n    print(result)  # {'name': 'test.txt', 'data': b'hello'}\n\ntest_factory()","lang":"python","description":"Demonstrates providing the IFileFactory interface and using a factory to create file representations."},"warnings":[{"fix":"Ensure Python 3.9 or later is used.","message":"Version 7.0 dropped support for Python versions older than 3.9. Upgrade your Python environment if you are using Python < 3.9.","severity":"breaking","affected_versions":">=7.0"},{"fix":"Replace usage of `IFileRepresentation` with `IFileFactory` and `IDirectoryFactory` as appropriate.","message":"The `IFileRepresentation` interface has been deprecated in favor of `IFileFactory` and `IDirectoryFactory`. Use the new interfaces for new code.","severity":"deprecated","affected_versions":">=5.0"},{"fix":"Use `from zope.filerepresentation import readFile`.","message":"Utility functions like `readFile` and `writeFile` are not available via top-level import; you must import them from `zope.filerepresentation` module. Do not attempt to import from `interfaces`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use IFileFactory and IDirectoryFactory instead, and ensure you are using version 5.0+ interfaces.","cause":"The interface IFileRepresentation was removed in a newer version.","error":"ImportError: cannot import name 'IFileRepresentation' from 'zope.filerepresentation.interfaces'"},{"fix":"Run `pip install zope.filerepresentation`.","cause":"The package is not installed.","error":"ModuleNotFoundError: No module named 'zope.filerepresentation'"},{"fix":"Define a __call__ method that accepts (name, data) parameters.","cause":"The factory object must implement __call__ method.","error":"TypeError: 'MyFileFactory' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}