Skip to main content

Timeline for Jinja2 template loader

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Mar 9, 2017 at 16:14 vote accept Mike
Mar 6, 2017 at 23:11 comment added Mike Okay that makes more sense, I thought there was some relation between the two but that clears things up. I am not trying to do anything specifically but gain an understanding of the different ways a script could be ran and how that effects global attributes like request data/jinja environment and things of that sort that all my rendering functions require. I was hoping that having an understanding of the different ways the script can be executed (cgi/wsgi being the primary ways) will allow me to develop my back end in a more 'correct' way.
Mar 6, 2017 at 22:10 comment added 301_Moved_Permanently @Turk Not sure about what you are trying to do. Running multiple instances of python (even in parallel) is not at all the same thing than running several threads into the same script. You don't have to consider concurency in the first case as each invocation will have to initialize an environment anyway; but in the second case you might need it. The lock I was thinking about comes from the threading module and is not really needed if you don't use anything from it.
Mar 6, 2017 at 22:03 comment added Mike Ah okay, is that lock atomic by chance? I am just getting into these new concepts of running multiple invocations of a script in serial/parallel or both. I thought my approach would be sound in that regard, but the more I look at your answer the more I agree with it
Mar 6, 2017 at 21:55 history edited 301_Moved_Permanently CC BY-SA 3.0
added 563 characters in body
Mar 6, 2017 at 21:50 comment added 301_Moved_Permanently @Turk Even with your approach you'll get the same kind of race condition when accessing the attribute the first times than calling the function the first times. The solution is not a switch of data model but a lock + second check.
Mar 6, 2017 at 20:34 comment added Mike I agree with this when looking at as a standalone example and that is essentially what I was working with before switching over to a property/class based data structure. I am shooting for a singleton design as I work towards multi-threaded processes down the road
Mar 6, 2017 at 18:36 history answered 301_Moved_Permanently CC BY-SA 3.0