Comments (9)
I think something like
try:
from oca.decorators import foreach
except ImportError:
foreach = lambda x: x
could do the trick. For every decorator we import, we declare it to be the identity function if the import fails. Then we don't need the ugly catch all import.
from oca-decorators.
I think that is a good workaround, although it should violate some pylint/flake8 too. By adding a # noqa
to the except it should be OK.
from oca-decorators.
However, there's a problem here that we've been struggling all the life: why in the world do we need to fake a requirement? If the addon is not installed and it produces an ImportError
... why should Odoo care at all? It's what should happen, because there's actually an import error! We should fix Odoo I think.
from oca-decorators.
Thanks a lot @hbrunn. I think we should add an help in the documentation of this library.
We should fix Odoo I think.
@yajo : 100% agree with you, but an other (big) story I think.
from oca-decorators.
Cool, it seems we're just late to the party.
The fix landed in master some months ago.
I think we could backport it to OCB and merge OCA/pylint-odoo#182 once for all and just stop supporting this precise kind of fixes for non OCB builds.
Would you agree?
cc @pedrobaeza
from oca-decorators.
Well, as we need to keep the tricks for Odoo part, it's not worth to backport it.
from oca-decorators.
I was talking about providing different kind of fixes:
- if you use OCB, it's fixed out of the box.
- if you use odoo, the fix is to add the dependency.
So both versions are "supported" but we don't care anymore about this.
from oca-decorators.
I was talking about providing different kind of fixes:
if you use OCB, it's fixed out of the box.
if you use odoo, the fix is to add the dependency.
So both versions are "supported" but we don't care anymore about this.
LGTM 👍
from oca-decorators.
I'm thinking that there's a still easier solution:
- in versions < 12.0, use
@api.one
- in versions >= 12.0 (when available), use this lib in OCA freely.
from oca-decorators.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oca-decorators.