[PEAK] adapt based on inheritance

Stephen Haberman stephenh at chase3000.com
Wed Jun 9 15:12:45 EDT 2004


Hi,

I'd like to do something like:

for f in modelElement.mdl_features:
    f = adapt(f, IMyFeatureInterface)

And then have model.Attribute features get adapted to MyAttributeFeature and
model.Collection features get adapted to MyCollectionFeature.

I was initially thinking asAdaptorForTypes would work, but the type of both
model.Attribute and model.Collection features is
peak.model.features.FeatureClass.

Is there a convenient way to adapt based on the base classes of the target
object? I was rather surprised I couldn't, though perhaps this is a misuse
of the adaption concept?

Thanks,
Stephen






More information about the PEAK mailing list