[Zope3-dev] Stylistic question about using adapters

Florent Guillaume fg at nuxeo.com
Fri Jan 21 10:01:44 EST 2005


[reposting here as it seems nobody reads zope3-users]

I'm wondering if using adapters is the best way to do the following:

I have a MailBox class that holds central information, and it contains
instances of MailFolder that themselve contain MailMessage. From the
code of a MailMessage, I need to get some config parameters from the
mailbox. So somewhere I have a function that goes up the containment
hierarchy to find an IMailBox (I'd rather not make it a method of
MailMessage because it's really got to do with the containment hierarchy
and not the behavior of the message itself).

Is it best to leave this function standalone and call it directly, or is
it better somehow to make it into an adapter from IMailMessage to
IMailBox ? I'm not really "adapting" here, I'm returning a completely
different object, so I have philosophical problems...

What do you think is best ?

Thanks,
Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope3-dev mailing list