Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] users_ldap_populate: Protect ldap library import #232

Merged
merged 1 commit into from
Aug 21, 2015

Conversation

pedrobaeza
Copy link
Member

To avoid errors on dependent builds

try:
from ldap.filter import filter_format
except ImportError:
_logger.debug('Can not `from ldap.filter import filter_format`.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_logger.warning instead of debug

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moylop260
Copy link
Contributor

👍

@moylop260
Copy link
Contributor

If fine to me
But if you add external depends is better: https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#__openerp__py

@pedrobaeza
Copy link
Member Author

As this module depends of auth_ldap, and that module already has that external_dependencies defined, is not explicitly needed.

@nhomar
Copy link
Member

nhomar commented Aug 20, 2015

👍

@nhomar
Copy link
Member

nhomar commented Aug 20, 2015

@pedrobaeza the problem of expect the external_dependency only in the parent module, when you click on "install" the screen will retreive an error mentioning the dependency, not the module itself, IMHO it is useful here, even if technically it is not necesary, but BTW you have my +1 we have a rule to follow, and the rule do not mention explicitally how manage the depednency itself.

@moylop260
Copy link
Contributor

@pedrobaeza
Ok, I got it
Thanks for explanation
confirmed 👍

@lmignon
Copy link
Sponsor Contributor

lmignon commented Aug 20, 2015

@pedrobaeza once a module do an explicit import of an external dependency you must declare the dependency into the manifest. It's required to avoid that if the decency is removed from the dependent module the current one will be broken.

@moylop260
Copy link
Contributor

@lmignon
You are right.
However, IMHO you should create a PR to add this case in https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#__openerp__py
And later we will need to fix all repo's

IMHO By this case the main goal is done!

@lmignon
Copy link
Sponsor Contributor

lmignon commented Aug 20, 2015

@moylop260 the rule is explicit.

If your module use extras dependencies of python or binaries you should add to __openerp__py file the section external_dependencies.

from ldap.filter import filter_format

The import means that this module use an extra dependency.

@pedrobaeza
Copy link
Member Author

As stated before in others PRs "Better explicit than implicit", so I have added the external_dependencies in the manifest.

@nhomar
Copy link
Member

nhomar commented Aug 21, 2015

comments applied, then +1 valid, I merge.

nhomar added a commit that referenced this pull request Aug 21, 2015
[FIX] users_ldap_populate: Protect ldap library import
@nhomar nhomar merged commit 603ceb8 into OCA:8.0 Aug 21, 2015
BT-rmartin referenced this pull request in brain-tec/server-tools Oct 13, 2015
[FIX] users_ldap_populate: Protect ldap library import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants