|
|
@@ -454,7 +454,7 @@ def duration_to_seconds(duration): |
|
|
|
|
|
|
|
def validate_duration_format(duration): |
|
|
|
import re |
|
|
|
is_valid_duration = re.match("^(?:(\d+d)?((^|\s)\d+h)?((^|\s)\d+m)?((^|\s)\d+s)?)$", duration) |
|
|
|
is_valid_duration = re.match(r"^(?:(\d+d)?((^|\s)\d+h)?((^|\s)\d+m)?((^|\s)\d+s)?)$", duration) |
|
|
|
if not is_valid_duration: |
|
|
|
frappe.throw(frappe._("Value {0} must be in the valid duration format: d h m s").format(frappe.bold(duration))) |
|
|
|
|
|
|
@@ -1341,10 +1341,10 @@ def expand_relative_urls(html): |
|
|
|
|
|
|
|
return "".join(to_expand) |
|
|
|
|
|
|
|
html = re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', _expand_relative_urls, html) |
|
|
|
html = re.sub(r'(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', _expand_relative_urls, html) |
|
|
|
|
|
|
|
# background-image: url('/assets/...') |
|
|
|
html = re.sub('(:[\s]?url)(\([\'"]?)((?!http)[^\'" >]+)([\'"]?\))', _expand_relative_urls, html) |
|
|
|
html = re.sub(r'(:[\s]?url)(\([\'"]?)((?!http)[^\'" >]+)([\'"]?\))', _expand_relative_urls, html) |
|
|
|
return html |
|
|
|
|
|
|
|
def quoted(url): |
|
|
@@ -1355,7 +1355,7 @@ def quote_urls(html): |
|
|
|
groups = list(match.groups()) |
|
|
|
groups[2] = quoted(groups[2]) |
|
|
|
return "".join(groups) |
|
|
|
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?:http)[^\'">]+)([\'"]?)', |
|
|
|
return re.sub(r'(href|src){1}([\s]*=[\s]*[\'"]?)((?:http)[^\'">]+)([\'"]?)', |
|
|
|
_quote_url, html) |
|
|
|
|
|
|
|
def unique(seq): |
|
|
|