Community mailing list archives
Re: broken Travis builds in OCA repositoriesby
Laurent Mignon - Senior Software Engineer, Acsone
IMO, imports must remains on top of the module. import inside the code is not a good practice and should be discouraged. I prefer a try catch on top of the file to a import lost in the code.
my 2 cents,
On Wed, Mar 25, 2015 at 10:43 AM, Stefan <email@example.com> wrote:
On 25-03-15 10:40, Alexandre Fayolle wrote: > On 25/03/2015 10:17, Stefan wrote: > > > > > Hi Alexandre, > > > > thank you for picking this up. When we encountered this in the past, our > > solution was to import the external dependency locally in the methods > > themselves. This preserves the clear runtime error mentioning the > > missing dependency. Would you consider this solution instead of catching > > ImportError at the top of the modules? > > > > > > That should be fine, yes, unless the addon is used in a tight loop. I'll > update the existing PRs and use this approach for the next ones. Great, thanks!