return strip_colors(self.nick)
def __repr__(self):
- return "<Player(%s, %s, %s, %s)>" % (self.player_id, self.nick,
- self.create_dt, self.location)
+ return "<Player(%s, %s)>" % (self.player_id,
+ self.nick.encode('utf-8'))
class Mutator(object):
self.name = name
def __repr__(self):
- return "<Server(%s, %s, %s)>" % (self.server_id, self.name,
- self.ip_addr)
+ return "<Server(%s, %s)>" % (self.server_id, self.name.encode('utf-8'))
class Map(object):
player_nick = session.query(PlayerNick).filter_by(\r
player_id=player.player_id, stripped_nick=stripped_nick).one()\r
except NoResultFound, e:\r
- # player_id/stripped_nick not found, create one\r
+ # player_id/stripped_nick not found, create one\r
# but we don't store "Anonymous Player #N"\r
if not re.search('^Anonymous Player #\d+$', player.nick):\r
player_nick = PlayerNick()\r
session.add(player_nick)\r
\r
# We change to the new nick regardless\r
- log.debug('Changing nick from {0} to {1} for player {2}'.format(\r
- player.nick, new_nick, player.player_id))\r
player.nick = new_nick\r
session.add(player)\r
\r
for line in request.body.split('\n'):\r
try:\r
(key, value) = line.strip().split(' ', 1)\r
+\r
+ # Server (S) and Nick (n) fields can have international characters.\r
+ # We encode these as UTF-8.\r
+ if key in 'S' 'n':\r
+ value = unicode(value, 'utf-8')\r
\r
if key in 'V' 'T' 'G' 'M' 'S' 'C' 'R' 'W':\r
game_meta[key] = value\r