• Jérome Perrin's avatar
    CMFActivity: Always set zope.globalrequest · 9651e553
    Jérome Perrin authored
    ERP5 uses a mix of context.REQUEST and Products.ERP5Type.Global.get_request(),
    which now uses zope.globalrequest.getRequest().
    CMFActivity reconstruct the original request before executing activity, so that
    the activity is executed with a request equivalent to the request at the time
    where the method was activated. For this, context.REQUEST was properly restored,
    but get_request()/globalrequest was only restored when the REQUEST had some
    Accept-Language header, so that it replays the language negociation for
    Localizer.
    
    With browser requests, I guess every browser pass an Accept-Language header (
    according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
    all major browser support it), but within unit tests such header is not present.
    So this lead to activities with unit test requests being slightly different,
    because as they don't have Accept-Language, context.REQUEST was set, but the
    global request was not set, so they were running with two different requests
    in context.REQUEST and global request, leading to some problems for example
    with formulator fields.
    9651e553
testCMFActivity.py 108 KB