{"action":"created","issue":{"url":"https://api.github.com/repos/JetBrains/teamcity-messages/issues/75","labels_url":"https://api.github.com/repos/JetBrains/teamcity-messages/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/JetBrains/teamcity-messages/issues/75/comments","events_url":"https://api.github.com/repos/JetBrains/teamcity-messages/issues/75/events","html_url":"https://github.com/JetBrains/teamcity-messages/pull/75","id":106669409,"number":75,"title":"Add escape_value function","user":{"login":"msabramo","id":305268,"avatar_url":"https://avatars.githubusercontent.com/u/305268?v=3","gravatar_id":"","url":"https://api.github.com/users/msabramo","html_url":"https://github.com/msabramo","followers_url":"https://api.github.com/users/msabramo/followers","following_url":"https://api.github.com/users/msabramo/following{/other_user}","gists_url":"https://api.github.com/users/msabramo/gists{/gist_id}","starred_url":"https://api.github.com/users/msabramo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msabramo/subscriptions","organizations_url":"https://api.github.com/users/msabramo/orgs","repos_url":"https://api.github.com/users/msabramo/repos","events_url":"https://api.github.com/users/msabramo/events{/privacy}","received_events_url":"https://api.github.com/users/msabramo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-15T23:37:52Z","updated_at":"2015-09-19T17:42:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JetBrains/teamcity-messages/pulls/75","html_url":"https://github.com/JetBrains/teamcity-messages/pull/75","diff_url":"https://github.com/JetBrains/teamcity-messages/pull/75.diff","patch_url":"https://github.com/JetBrains/teamcity-messages/pull/75.patch"},"body":"In some cases, it might be useful to call `escape_value` as a simple function without instantiating a `TeamcityServiceMessages` object.\r\n\r\ne.g.:\r\n\r\n```python\r\nIn [1]: from teamcity.messages import escape_value\r\n\r\nIn [2]: escape_value(\"That's some text in [square brackets] and |vertical bars|\\n\")\r\nOut[2]: \"That|'s some text in [square brackets|] and ||vertical bars|||n\"\r\n```\r\n\r\nThis is useful to me, because I have some bash code that emits TeamCity messages and I would like to be able to reuse this Python code to do the escaping. With this, I can change the code from:\r\n\r\n```bash\r\nteamcity_escape() {\r\n  echo \"$@\" | python -c 'import sys; from teamcity.messages import TeamcityServiceMessages; tc = TeamcityServiceMessages(); print(tc.escapeValue(sys.stdin.read()))'\r\n}\r\n```\r\n\r\nto:\r\n\r\n```bash\r\nteamcity_escape() {\r\n  echo \"$@\" | python -c 'import sys; from teamcity.messages import escape_value; print(tc.escape_value(sys.stdin.read()))'\r\n}\r\n```\r\n\r\nNote that I provide a `escapeValue` function to be consistent with the camelCased names that this module uses, but I also provided `escape_value` as an alias because that is more Pythonic and compliant with [PEP-8](https://www.python.org/dev/peps/pep-0008/).\r\n\r\nCc: @sudarkoff, @aconrad, @0x9900"},"comment":{"url":"https://api.github.com/repos/JetBrains/teamcity-messages/issues/comments/141692941","html_url":"https://github.com/JetBrains/teamcity-messages/pull/75#issuecomment-141692941","issue_url":"https://api.github.com/repos/JetBrains/teamcity-messages/issues/75","id":141692941,"user":{"login":"shalupov","id":1244223,"avatar_url":"https://avatars.githubusercontent.com/u/1244223?v=3","gravatar_id":"","url":"https://api.github.com/users/shalupov","html_url":"https://github.com/shalupov","followers_url":"https://api.github.com/users/shalupov/followers","following_url":"https://api.github.com/users/shalupov/following{/other_user}","gists_url":"https://api.github.com/users/shalupov/gists{/gist_id}","starred_url":"https://api.github.com/users/shalupov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shalupov/subscriptions","organizations_url":"https://api.github.com/users/shalupov/orgs","repos_url":"https://api.github.com/users/shalupov/repos","events_url":"https://api.github.com/users/shalupov/events{/privacy}","received_events_url":"https://api.github.com/users/shalupov/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T17:42:58Z","updated_at":"2015-09-19T17:42:58Z","body":"Thanks! Looks good.\r\n\r\nCould you rename escapeValue global function to escape_value? We certainly don't need both of them and PEP8 likes escape_value"}}