Hi Anand,

I see that no one has put our dbase bug-fix into http.background().  
It's a pretty bad bug causing random dbase corruption.  See below

Thanks,
Berwyn

def background(func):
    """A function decorator to run a long-running function as a 
background thread.
+        GOTCHA: Until the foreground task ends, any db access by 
background task
+        will necessarily get old data from before the foreground task 
started
+        because psycopg2 begins a transaction in the foreground task 
until it quits """
    def internal(*a, **kw):
        web.data() # cache it

        tmpctx = web._context[threading.currentThread()]
        web._context[threading.currentThread()] = 
utils.storage(web.ctx.copy())

        def newfunc():
            web._context[threading.currentThread()] = tmpctx
+            # Create new db cursor if there is one else background thread
+            #  overwrites foreground cursor causing rubbish data into dbase
+            if web.config.get('db_parameters'):
+                webdb.connect(**web.config.db_parameters)
            func(*a, **kw)


Anand wrote:
> Its time to release the bug fixes in the trunk as a minor version and  
> use trunk for further development.
>
> The changes are:
>      compatibility with new DBUtils API (122112)
>      fix reloading (118683)
>      fix compatibility between `changequery` and `redirect` (118234)
>      fix relative URI in `web.redirect` (118236)
>      fix `ctx._write` support in built-in HTTP server (121908)
>      fix `numify` strips things after '.'s (118644)
>      fix various unicode isssues (114703, 120644, 124280)
>
> Please test this out with your software and let me know if there are  
> any issues.
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to