-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make escaping strings more consistent. #7059
Conversation
e9b7a8b
to
c1d90b4
Compare
fc5e7a3
to
459995b
Compare
tests/test_edgeql_data_migration.py
Outdated
@@ -140,7 +141,7 @@ async def fast_forward_describe_migration( | |||
interpolations[var_name] = var_value | |||
|
|||
for stmt in mig['proposed']['statements']: | |||
curddl = stmt['text'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to have to an add unescape_string
here. This is testing exposed behavior; if we update this, we'd need to update our CLI's migration flows, and we'd break any user using this.
824678d
to
251d3c9
Compare
edb/edgeql/quote.py
Outdated
|
||
result = result.replace('\'', '\\\'') | ||
result = result.replace('\"', '\\\"') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to escape double quotes
result = result.replace('\b', '\\b') | ||
result = result.replace('\f', '\\f') | ||
result = result.replace('\n', '\\n') | ||
result = result.replace('\r', '\\r') | ||
result = result.replace('\t', '\\t') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this table driven?
(Or maybe just not bother)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure's just in one of your new tests
* Make escaping strings more consistent. * Add unescape_string and fix migration tests. * Fix json when selecting migration description. * Fix formatting. * Remove python string escaping json description. * Add escape for double quote. * Remove unescape_string. * Remove separate escape_string function. * Remove double quote escape. * Fix test.
* Make escaping strings more consistent. * Add unescape_string and fix migration tests. * Fix json when selecting migration description. * Fix formatting. * Remove python string escaping json description. * Add escape for double quote. * Remove unescape_string. * Remove separate escape_string function. * Remove double quote escape. * Fix test.
When running the migration described in #5728, the output is changed to:
json output:
default output:
Note: Json output changes as the backslashes are now escaped as well as the quotes. This behaviour should be more "correct".