|
|
|
|
@ -40,17 +40,17 @@ except ImportError:
|
|
|
|
|
raise MissingDependency(
|
|
|
|
|
"The 'whoosh' backend requires the installation of 'Whoosh'. Please refer to the documentation.")
|
|
|
|
|
|
|
|
|
|
# Handle minimum requirement.
|
|
|
|
|
#姜雨菲: 检查Whoosh版本,要求2.5.0及以上
|
|
|
|
|
if not hasattr(whoosh, '__version__') or whoosh.__version__ < (2, 5, 0):
|
|
|
|
|
raise MissingDependency(
|
|
|
|
|
"The 'whoosh' backend requires version 2.5.0 or greater.")
|
|
|
|
|
|
|
|
|
|
# Bubble up the correct error.
|
|
|
|
|
|
|
|
|
|
#姜雨菲:日期时间格式正则表达式,用于解析Whoosh返回的日期时间字符串
|
|
|
|
|
DATETIME_REGEX = re.compile(
|
|
|
|
|
'^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})T(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})(\.\d{3,6}Z?)?$')
|
|
|
|
|
LOCALS = threading.local()
|
|
|
|
|
LOCALS.RAM_STORE = None
|
|
|
|
|
LOCALS.RAM_STORE = None # 线程本地存储,用于内存存储模式
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WhooshHtmlFormatter(HtmlFormatter):
|
|
|
|
|
|