Fixed a bug in telnet protocol that stripped wrong characters at the end. Resolves Issue 318.

This commit is contained in:
Griatch 2012-10-28 10:37:14 +01:00
parent 58533165eb
commit ee7a175bf4
2 changed files with 14 additions and 4 deletions

View file

@ -202,10 +202,17 @@ class CmdSet(object):
Returns a new cmdset with the same settings as this one
(no actual commands are copied over)
"""
cmdset = self.__class__()
cmdset.__dict__.update(dict((key, val) for key, val in self.__dict__.items() if key in self.to_duplicate))
cmdset.key_mergetypes = self.key_mergetypes.copy() #copy.deepcopy(self.key_mergetypes)
cmdset = CmdSet()
for key, val in ((key, getattr(self, key)) for key in self.to_duplicate):
if val != getattr(cmdset, key):
# only copy if different from default; avoid turning class-vars into instance vars
setattr(cmdset, key, val)
cmdset.key_mergetypes = self.key_mergetypes.copy()
return cmdset
#cmdset = self.__class__()
#cmdset.__dict__.update(dict((key, val) for key, val in self.__dict__.items() if key in self.to_duplicate))
#cmdset.key_mergetypes = self.key_mergetypes.copy() #copy.deepcopy(self.key_mergetypes)
#return cmdset
def __str__(self):
"""