Nereid 3.2에서 최대 재귀 깊이 오류가 발생합니다. 나는이 오류의 주요 원인을 발견 나는 네 레이스의 speaklater 게으른 렌더링 기능에 대한 문제의 원인이 될 수있다 발견 디버깅에오류 : Nereid에서 flask-babel 메서드를 사용할 때 최대 재귀 깊이가
{{ blog_date | dateformat(format='MMM YY') }}
같은 신사 템플릿 바벨 dateformat filter입니다.
Nereid 3.2에서 최대 재귀 깊이 오류가 발생합니다. 나는이 오류의 주요 원인을 발견 나는 네 레이스의 speaklater 게으른 렌더링 기능에 대한 문제의 원인이 될 수있다 발견 디버깅에오류 : Nereid에서 flask-babel 메서드를 사용할 때 최대 재귀 깊이가
{{ blog_date | dateformat(format='MMM YY') }}
같은 신사 템플릿 바벨 dateformat filter입니다.
마지막으로 해결책을 얻었으며 여기에 도달하는 방법이 있습니다.
플라스크의 재귀 깊이 오류는 문제의 근본 원인을 찾기가 쉽지 않으므로 히트 앤 트라이얼 방식으로 문제의 꼬리가 있습니다.
메소드 호출 흐름은 다음과 같이이다 :
에 dateformat 필터>format_date()>to_user_timezone()>get_timezone()
이제 시간대 방법으로 here 재정의 얻을 : here에서
def get_timezone():
"""
Returns the timezone that should be used for this request as
`pytz.timezone` object. This returns `None` if used outside of
a request.
"""
ctx = _request_ctx_stack.top
tzinfo = getattr(ctx, 'babel_tzinfo', None)
if tzinfo is None:
babel = ctx.app.extensions['babel']
if babel.timezone_selector_func is None:
if not current_user.is_anonymous() and current_user.timezone:
tzinfo = timezone(current_user.timezone)
else:
tzinfo = timezone(ctx.request.nereid_website.timezone)
else:
rv = babel.timezone_selector_func()
if rv is None:
tzinfo = babel.default_timezone
else:
if isinstance(rv, basestring):
tzinfo = timezone(rv)
else:
tzinfo = rv
ctx.babel_tzinfo = tzinfo
return tzinfo
flask.ext.babel.get_timezone = get_timezone
그것이 function field timezone를 호출 nereid_website에서는 기본적으로 회사의 timezone을 반환하며이 필드는 필요하지 않습니다.
마지막으로 PR#229에서이 문제를 해결했습니다. 리뷰어를 환영합니다!