datawire / datawire-cli

Datawire Cloud tools and utilities
1 stars 0 forks source link

Unicode characters in service token crashes create-service #30

Open janicedatawire opened 8 years ago

janicedatawire commented 8 years ago

I was able to use unicode characters in org and user names, but I just tried it in a service handle and it crashed create-service:

$ dwc create-service 34r789fifj84fyhujk3498hcn3ofihjp32fjh981349u457849387489@#$345tghjkxmÎÏÓÔfiflˆjfds
Traceback (most recent call last):
  File "/Users/janicekarin/venv6/bin/dwc", line 519, in <module>
    rc = parser.parse()
  File "/Users/janicekarin/venv6/bin/dwc", line 101, in parse
    return handler(self, dwc, dwState, args)
  File "/Users/janicekarin/venv6/bin/dwc", line 139, in decorated
    return callable(self, dwc, dwState, args)
  File "/Users/janicekarin/venv6/bin/dwc", line 496, in handle_service_create
    print("Creating service %s in %s..." % (service_handle, orgID))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 84: ordinal not in range(128)
kflynn commented 8 years ago

Hmmm. My experiment with non-ASCII characters didn't work for create-org either, so at least we're consistent:

dwc --local create-org "Taquería Dos Cañones" Flynn flynn+tacos@datawire.io
Choose a password for flynn+tacos@datawire.io @ Taquería Dos Cañones: 
Confirm password: 
failure: No result from request (status 500)!

and from the server:

    print("<<< CREATE ORG: %s" % result)
  File "/Users/flynn/datawire/cloud-tools/datawire/utils/__init__.py", line 20, in <lambda>
    __str__ = lambda x: unicode(x).encode('utf-8')
  File "/Users/flynn/datawire/cloud-tools/datawire/utils/__init__.py", line 75, in __unicode__
    " ".join([ '%s="%s"' % (key, getattr(self, key)) for key in self.keys ])))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 32: ordinal not in range(128)

Python 2 Unicode support is so annoying. :(