Replies: 7 comments
-
I cannot comment on code that I haven't seen. But in any case, I've added an asyncio version of the file upload example: https://github.com/miguelgrinberg/microdot/blob/main/examples/uploads/uploads_async.py. |
Beta Was this translation helpful? Give feedback.
-
That is really true! I'll try it with your example. If I get stuck, I'll post my code example. |
Beta Was this translation helpful? Give feedback.
-
Can you give me a hint on the global variables question - it's a mystery to me |
Beta Was this translation helpful? Give feedback.
-
It works now!! |
Beta Was this translation helpful? Give feedback.
-
I can't answer your global variables questions, because I don't understand what you are asking me. Same as before, without code it is difficult. Microdot has nothing to do with global variables, you should be able to use them when it makes sense. The |
Beta Was this translation helpful? Give feedback.
-
I agree to 100 percent - thank you anyway for the quick answer. It is sometimes not so easy to use the documentation correctly in a new area. But I can assure you that I have read the document several times. Unfortunately, I am not getting anywhere with two issues:
I'm not sure if you need more of the code? This was my last try, breaks with a "TypeError: 'Response' object isn't iterable", the other tries run without error - but landing in the root-tree without path. |
Beta Was this translation helpful? Give feedback.
-
What does "previous path" mean here? How would the server know what the previous path is? All you need to do after you save the file is to return a redirect to the place you want to go. The after_request thing that you are doing does not really make sense in this case.
What cookies? You don't have any cookies in the code you copied in your question. Cookies cannot be "lost" because they are kept by the client. Nothing you can do on the server other than explicitly telling the client to delete can make a cookie disappear. |
Beta Was this translation helpful? Give feedback.
-
Hi Miguel,
it's Magnus once again. Thanks for the great framework.
Your upload example works in the threat variant in my code too, but not in the asyncio variant. Do you have an idea why? The error is: TypeError: object with buffer protocol required.
I have another question. Why can't I use global variables in the code that I need to query / set between requests.
Beta Was this translation helpful? Give feedback.
All reactions