Skip to content

Commit

Permalink
OSX Config GUI: Ensure input values are encoded to UTF-8, for compati…
Browse files Browse the repository at this point in the history
…bility with Python 2.7. Fixes #54.
  • Loading branch information
tomas authored and mauricioschneider committed Jul 1, 2015
1 parent 6ea410f commit cdca722
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def is_client_configured(self):
return self.code == 0

def get_value(self, input_id):
return self.inputs[input_id].objectValue()
return self.inputs[input_id].stringValue().encode('utf-8')

def valid_email_regex(self, string):
if len(string) > 7:
Expand All @@ -350,7 +350,7 @@ def valid_email_regex(self, string):

def validate_email(self, email):
if not self.valid_email_regex(email):
self.show_alert("Please make sure the email address you typed is valid.")
self.show_alert("Please make sure the email address is valid.")
return False

return True
Expand Down Expand Up @@ -417,8 +417,8 @@ def run_command(self, cmd):
proc = Popen(args, stdout=PIPE, shell=False)
self.out = proc.communicate()[0]
self.code = proc.returncode
except OSError as e:
self.out = e.strerror
except (TypeError, OSError) as e:
self.out = "Exception! %s" % e
self.code = 1

######################################################
Expand Down

0 comments on commit cdca722

Please sign in to comment.