Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-03-30 13:53:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-30 13:57:23 +0300
commit681a7d724b1ab7df811adb951239ff35c9dbaa1f (patch)
tree22d85bbb0730f2839604516466a67aab39f0a2b8 /release
parent5da5a1cc2da885346efe47ed1ea39a82e5aa42d5 (diff)
PyAPI: replace repr with our own escape function in animsys_refactor
Use the same string escaping logic shared by RNA path resolving code.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/animsys_refactor.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py
index 97e8a8dd144..fd4952e2a53 100644
--- a/release/scripts/modules/animsys_refactor.py
+++ b/release/scripts/modules/animsys_refactor.py
@@ -32,12 +32,6 @@ import bpy
IS_TESTING = False
-def drepr(string):
- # is there a less crappy way to do this in python?, re.escape also escapes
- # single quotes strings so can't use it.
- return '"%s"' % repr(string)[1:-1].replace("\"", "\\\"").replace("\\'", "'")
-
-
def classes_recursive(base_type, clss=None):
if clss is None:
clss = [base_type]
@@ -66,7 +60,7 @@ class DataPathBuilder:
if type(key) is int:
str_value = '[%d]' % key
elif type(key) is str:
- str_value = '[%s]' % drepr(key)
+ str_value = '["%s"]' % bpy.utils.escape_identifier(key)
else:
raise Exception("unsupported accessor %r of type %r (internal error)" % (key, type(key)))
return DataPathBuilder(self.data_path + (str_value, ))