player.player_id, hashkey.hashkey))\r
except:\r
player = Player()\r
+ session.add(player)\r
+ session.flush()\r
\r
+ # if nick is given to us, use it. If not, use "Anonymous Player"\r
+ # with a suffix added for uniqueness.\r
if nick:\r
player.nick = nick\r
+ else:\r
+ player.nick = "Anonymous Player #{0}".format(player.player_id)\r
\r
- session.add(player)\r
- session.flush()\r
hashkey = Hashkey(player_id=player.player_id, hashkey=hashkey)\r
session.add(hashkey)\r
log.debug("Created player {0} with hashkey {1}.".format(\r
if pgstat.nick == None:\r
pgstat.nick = player.nick\r
\r
+ # if the nick we end up with is different from the one in the\r
+ # player record, change the nick to reflect the new value\r
+ if pgstat.nick != player.nick:\r
+ player.nick = pgstat.nick\r
+ session.add(player)\r
+\r
session.add(pgstat)\r
session.flush()\r
\r