[INSTRM-383] String keywords not always escaped in a way which can be predictably unescaped. Created: 11/Jun/18 Updated: 13/Jun/18 |
|
| Status: | Open |
| Project: | Instrument control development |
| Component/s: | tron_actorcore |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Normal |
| Reporter: | cloomis | Assignee: | cloomis |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Transferring headers from gen2Actor has uncovered an old mistake. The symptom is that only one of: header1 = r"""OBSERVER = '"Name, Other Name"' / double-quoted""" header2 = r"""OBSERVER = 'Name' / Not double-quoted""" can make it through from one of: cmd.inform('header=%s' % (header)) cmd.inform('header=%s' % (repr(header))) to an identical string at the listener: header = self.actor.models['gen2']['header'].values[0] I believe that the issue boils down to a pre-SDSS choice not to internally use repr to encode a string (because it does too much and makes strings ugly), but not fixing the decoding when SDSS switched to the opscore parser. Basically: from opscore.utility.qstr import qstr s = "any horrible thing" # OK eval(repr(s) == s # By definition # Not OK eval(qstr(repr(s)) != s # double-quotes get an additional escaping. qstr(s) != s # Of course not. |