[PEAK] adapt factory parameter

Stephen Haberman stephenh at chase3000.com
Wed Jun 9 23:05:05 EDT 2004

> protocols.declareAdapter(
>       multi_adapter(a1,a2),
>       provides=[ISQLFeature],
>       forObjects=[model.Attribute]
> )

I like this. I think I'll change it just a bit to be config driven, e.g.:


With config something like:

a = app.attributeAdapter
b = app.collectionAdapter

Where this is for the framework and then individual apps could by adding in
their config file:

c = theirapp.fooAdapter

Granted, the a..c key thing is odd, as I really don't need the key and will
probably ignore it, I just need to be able to loop over app.adapters values
defined in multiple config files and having just one (like below) wouldn't
work (in that the 2nd app-specific config file would have to completely
redefine adapters to be attributeAdapter, collectionAdapter, and fooAdapter,
instead of just specifying their own new fooAdapter).

adapters = [app.attributeAdapter, app.collectionAdapter]

So, thanks, I like this idiom. If you see any things stylistically I could
do that would make it cleaner or more PEAK-ish, e.g. that whole a..c key
thing, I'd appreciate it. But if not, that's fine, I'm pretty sure I can
plug along with this.

- Stephen

More information about the PEAK mailing list