Previous Chapter | Next Chapter | Up | Next Section | Contents

Classes inside Classes


A common scenario is to create a Z Class which inherits from ObjectManager, and then to create several classes which are meant to be used exclusively inside the container class. An example might be a CDLibrary class and a CD class. CD objects should never appear outside CDLibrary objects.

A simple way to accomplish this sort of thing is to create classes inside other classes. The contained classes should be created inside the "Methods" view of the containing class. Zope will automatically add the contained classes to the list of sub-objects of the container class.

Another reason to create classes inside classes is to avoid having the inner classes appear on the global product add list. Only classes with associated Factories which are created directly inside product Folders will appear on the global product add list.

Previous Chapter | Next Chapter | Up | Next Section | Contents

Banner.Novgorod.Ru