Replies: 4 comments 5 replies
-
Hey @BwL1289 - would you be able to share a complete sample so we can tinker it through? From the top of my head, you could:
It's been a while since I last used Flask-Restful so a working (deployable) example would be great to experiment a pattern we could document for everyone. Thanks a lot for kicking this discussion! PS: We might make better progress in January due to winter holidays for all maintainers (I'll put up a notice this week). |
Beta Was this translation helpful? Give feedback.
-
Hey @leandrodamascena! I had to temporarily move to a different (albeit related) project, so apologies for the delay on getting you the full example. For the future, please let me know if it's OK to send you the example privately due to privacy concerns. Of course, let's post the solution here so everyone can learn from it! A bit off-topic, but related, to this discussion — we're using powertools in another project we're working on, but we'd like to use it on methods in a class. This class does not use Flask-Restful (just a regular python class). I haven't found any examples and can't find a way to avoid the mismatch between what the decorators expect as a first arg (
PyLance reports: Again, it's blatantly obvious why it's happening, but can't find a workaround. Apologies in advance if it's obvious how to do so and I'm missing something, but sincerely appreciate the help! |
Beta Was this translation helpful? Give feedback.
-
Hi @BwL1289, sorry for the late reply! We had internal meetings and stuff and things were really busy here. Yes, you can send me the project directly through Discord or another option that you find most suitable. Related to Pylance, I couldn't simulate here. I created a class and method exactly like you and Pylance didn't complain about anything. Can you send me a screenshot or full example to verify this? Thank you. |
Beta Was this translation helpful? Give feedback.
-
I'm closing this discussion as resolved. Please reopen if you need. |
Beta Was this translation helpful? Give feedback.
-
Hello! Apologies if this has been covered elsewhere, but I've looked and haven't found anything explicitly addressing it, and I can't find anything that explicitly says it can't be done.
Currently using Flask and Flask-Restful, and am slowly incorporating lambda power tools into the stack. My question is: is it possible to use lambda power tools with Flask (with or without Flask-Restful)?
I understand it's not a full replacement for Flask, but i'd love to incorporate the convenience of powertools into our stack to get to "well architected" even if I needed to rip out Flask-Restful.
I know there's some functionality that simply won't work without the
event handler
(i.e. raising HTTP errors, etc), but I would hope that some functionality like the below would be available:Looking at the source code, it's completely obvious why this is happening, but wanted to open a discussion to see if anyone has found workarounds without migrating an entire codebase at once.
Consistent error I'm seeing:
TypeError: decorate() missing 1 required positional argument: 'context'
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions