def setLanguageBindings(site, event):
    # Fixes issue where language bindings are not set, because language tool
    # check explicitly for HTTPRequest, which TaskQueueRequest only inherits.
    request = getattr(event, 'request', None)
    if not ITaskQueueLayer.providedBy(request):
        return
    portal_languages = getToolByName(site, 'portal_languages')
    portal_languages.setLanguageBindings()
Beispiel #2
0
def setLanguageBindings(site, event):
    # Fixes issue where language bindings are not set, because language tool
    # check explicitly for HTTPRequest, which TaskQueueRequest only inherits.
    # Note: Plone >= 5 no longer has LanguageTool and this is not required.
    request = getattr(event, 'request', None)
    if not ITaskQueueLayer.providedBy(request):
        return
    portal_languages = getToolByName(site, 'portal_languages')
    portal_languages.setLanguageBindings()
Beispiel #3
0
    def extractCredentials(self, request):
        # Check if request provides ITaskQueueLayer
        if not ITaskQueueLayer.providedBy(request):
            return {}

        # Read magical header
        task_user_id = request.getHeader('X-Task-User-Id')
        if task_user_id != None:
            return {'login': task_user_id}

        return {}
    def extractCredentials(self, request):
        # Check if request provides ITaskQueueLayer
        if not ITaskQueueLayer.providedBy(request):
            return {}

        # Read magical header
        task_user_id = request.getHeader('X-Task-User-Id')
        if task_user_id != None:
            return {'login': task_user_id}

        return {}