Commits

Marcin Kasperski committed 9990c35

improving playername impl

Comments (0)

Files changed (1)

src/mekk/fics/datatypes/player.py

 from collections import namedtuple
 
 # How much of name remains in truncated form
-TRUNCATED_LEN = 8 # TODO: check, it is probably a bit more
+TRUNCATED_LEN = 8 # TODO: check, it is probably a bit more. But never set it too high!
 
 class PlayerName(object):
     """
 
     def __init__(self, name, can_be_truncated=False):
         self.name = name
-        self.trunc = can_be_truncated
+        # If name is short, it can't be truncated
+        self.trunc = can_be_truncated and len(name) >= TRUNCATED_LEN
 
     def __str__(self):
         return self.name