Merge lp://staging/~openerp-dev/openobject-server/7.0-import-non-local-warning-mat into lp://staging/openobject-server/7.0

Proposed by Martin Trigaux (OpenERP)
Status: Needs review
Proposed branch: lp://staging/~openerp-dev/openobject-server/7.0-import-non-local-warning-mat
Merge into: lp://staging/openobject-server/7.0
Diff against target: 45 lines (+11/-2)
2 files modified
openerp/service/workers.py (+2/-1)
openerp/tools/misc.py (+9/-1)
To merge this branch: bzr merge lp://staging/~openerp-dev/openobject-server/7.0-import-non-local-warning-mat
Reviewer Review Type Date Requested Status
Lionel Sausin - Initiatives/Numérigraphe (community) Needs Information
OpenERP Core Team Pending
Review via email: mp+210399@code.staging.launchpad.net

Description of the change

Avoiding to get the warning message when importing the python module 'resource'.

Way to reproduce:
- launch openerp with --workers=1
-> get WARNING ? openerp.modules.module:
Ambiguous import: the OpenERP module `resource` is shadowed by another
module (available at /usr/lib/python2.7/lib-dynload/resource.so).
To import it, use `import openerp.addons.<module>.`.

Probably a bit overkill, not sure we should merge that...

Another way would be to simply reduce the log level to 'debug'

To post a comment you must log in.
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Why would import openerp.addons.resource not work ?

review: Needs Information
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

What do you mean by "not work". As far as I know, it currently works fine, just displaying a non-harmful message. My patch gives you a way to remove this warning in the workers.

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Yes sorry, I mean would it not remove the warning too?

Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

This would mean than, when importing resource, meaning <the python resource module>, you can use the code:

import openerp.tools.misc as misc
resource = misc.import_non_local('resource')

And it will have the same effect without showing warning message.
When you want to import the openerp module, you still need to use the `import openerp.addons.resource` syntax

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Ok I get it now, thanks.

Unmerged revisions

5257. By Martin Trigaux (OpenERP)

[IMP] import resource (python module) in a way we avoid triggering the warning (name clash with module resource)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.