ソースを参照

fix: Python 3 issue on re (#13230)

Python 3 interprets string literals as Unicode strings, and therefore \s and \g are treated as escaped Unicode characters.

Fix: Declare RegEx pattern as a raw string instead by prepending r
version-14
Joseph Marie Alba 4年前
committed by GitHub
コミット
e8d79030f7
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更1行の追加1行の削除
  1. +1
    -1
      frappe/translate.py

+ 1
- 1
frappe/translate.py ファイルの表示

@@ -650,7 +650,7 @@ def write_csv_file(path, app_messages, lang_dict):

t = lang_dict.get(message, '')
# strip whitespaces
translated_string = re.sub('{\s?([0-9]+)\s?}', "{\g<1>}", t)
translated_string = re.sub(r'{\s?([0-9]+)\s?}', r"{\g<1>}", t)
if translated_string:
w.writerow([message, translated_string, context])



読み込み中…
キャンセル
保存