[Tutor] Dynamic inheritance?

Jan Eden lists at janeden.org
Sat Nov 19 16:45:50 CET 2005


I have a number of classes, each of which should inherit from a related superclass in another module:

class A(Super.A):

class B(Super.B):

class C(Super.C):

Is there a way to dynamically determine the value of Super at runtime? Background: Depending on certain object attributes which are set during the object initialization, I need to use a different set of templates for the respective object.

Example: If a page object belongs to site A, it needs to inherit from the template class SiteA.Page, a gallery object belonging to site B should inherit from SiteB.Gallery etc.

The problem is that the template classes are not self contained, i.e. SiteB.Gallery inherits from SiteB.List, SiteB.Base etc.

Thanks in advance,

Any sufficiently advanced technology is insufficiently documented.

More information about the Tutor mailing list