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

Chapter 22. Object-to-Filesystem Mapping... > Step 3: The IReadDirectory Implement...

Step 3: The IReadDirectory Implementation

You are finally ready to give your content components, MessageBoard and Message, a cool filesystem representation.

The Directory Implementation

You need to realize that zope.app.folder.filerepresentation.ReadDirectory already has a nice implementation, except for the superfluous SiteManager class support and the missing contents file. So you simply subclass this class and overwrite keys(), get(key, default=None), and len(). All the other methods depend on these three. So your code for the ReadDirectory class, which you should place in filerepresentation.py, looks like this:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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