BASEDIR/nickname is now UTF-8 encoded

This commit is contained in:
Brian Warner 2008-09-20 11:37:13 -07:00
parent 0a59991ce6
commit 063f85d157
3 changed files with 8 additions and 5 deletions

View File

@ -22,7 +22,8 @@ attach a client to that grid
nickname (optional): The contents of this file will be displayed in nickname (optional): The contents of this file will be displayed in
management tools as this node's "nickname". If the file doesn't exist, the management tools as this node's "nickname". If the file doesn't exist, the
nickname will be set to "<unspecified>". nickname will be set to "<unspecified>". This file shall be a UTF-8 encoded
unicode string.
webport (optional): This controls where the client's webserver should listen, webport (optional): This controls where the client's webserver should listen,
providing filesystem access as defined in webapi.txt . This file contains a providing filesystem access as defined in webapi.txt . This file contains a

View File

@ -65,9 +65,11 @@ class Client(node.Node, testutil.PollMixin):
node.Node.__init__(self, basedir) node.Node.__init__(self, basedir)
self.started_timestamp = time.time() self.started_timestamp = time.time()
self.logSource="Client" self.logSource="Client"
self.nickname = self.get_config("nickname") nickname_utf8 = self.get_config("nickname")
if self.nickname is None: if nickname_utf8:
self.nickname = "<unspecified>" self.nickname = nickname_utf8.decode("utf-8")
else:
self.nickname = u"<unspecified>"
self.init_introducer_client() self.init_introducer_client()
self.init_stats_provider() self.init_stats_provider()
self.init_lease_secret() self.init_lease_secret()

View File

@ -91,7 +91,7 @@ class IntroducerClient(service.Service, Referenceable):
self._tub = tub self._tub = tub
self.introducer_furl = introducer_furl self.introducer_furl = introducer_furl
self._nickname = nickname self._nickname = nickname.encode("utf-8")
self._my_version = my_version self._my_version = my_version
self._oldest_supported = oldest_supported self._oldest_supported = oldest_supported