On 24/12/11 14:21 +0100, Mathias Behrle wrote:
> > Why not provide an efficient helper function which checks if a module is
> > installed ?
> > 
> > ```
> > from trytond.tools import is_module_installed
> > 
> > class Something(ModelSQL):
> >     def create(self, values):
> >         if is_module_installed(['sale', 'something_else']):
> >             # do something
> >         #anyway do this which is common
> > 
> > ```
> > 
> > Though this might make methods bulky, I think it makes it more findable 
> > (and 
> > hence readable) rather than having a lot of glue modules distributing
> > functionality across the place.
> 
> I like the direction of this idea most until now, because something like this
> could also provide the flexibility needed to handle Or cases:
> 
> if is_module_installed(['sale_kit']):
>     # do something
> elif is_module_installed(['sale_production']):
>     # do soemthing else

This is really something to avoid absolutly because it breaks the
modularity.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpW2EhwIvNMU.pgp
Description: PGP signature

Reply via email to