• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 22. Object-to-Filesystem Mapping... > Step 2: The Virtual Contents File Ad...

Step 2: The Virtual Contents File Adapter

How you implement the virtual contents file is fully up to you. However, you can do less work if you choose one way over another. The best method is to create a new interface, IVirtualContentsFile, which extends zope.app.file.interfaces.IFile. The advantage of doing this is that there are already filesystem-specific adapters (implementing zope.app.filerepresentation.interfaces.IReadFile and zope.app. filerepresentation.interfaces.IWriteFile) for the IFile interface. IFile might not be the best and most concise interface for your needs, but the advantages of using it are very convincing.

The Virtual Contents File Interface

When you look through the Zope 3 source code, you should notice that the IFile and IFileContent interfaces go hand-in-hand with each. Thus, your virtual contents file interface will extend both of these interfaces:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint