Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions plone/app/blocks/layoutbehavior.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from hashlib import md5
import hashlib
import logging

from lxml import html
Expand Down Expand Up @@ -83,7 +83,15 @@ class ILayoutAware(model.Schema):
alsoProvides(ILayoutAware['sectionSiteLayout'], IOmittedField)


@cache(lambda fun, path, resolved: md5(resolved).hexdigest())
def md5_fips(data):
try:
return hashlib.new('md5', data, usedforsecurity=False)
except TypeError:
# in case FIPS is not supported
return hashlib.md5(data)


@cache(lambda fun, path, resolved: md5_fips(resolved).hexdigest())
def applyTilePersistent(path, resolved):
"""Append X-Tile-Persistent into resolved layout's tile URLs to allow
context specific tile configuration overrides.
Expand Down