[PyTalker]: Bug in 0.1.2 corrected!

  • From: Daniel Alexandre <daniel@xxxxxxxxxxxxxxx>
  • To: pytalker@xxxxxxxxxxxxx
  • Date: Thu, 3 Mar 2005 00:35:44 +0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

After a few research with my friend google, I've finally discovered a way to remove the non-printable text bug still resident in the last version of PyTalker (v0.1.2). However I'm not going to deploy a new version yet, and this bug will be corrected in the new release (0.1.3). Meanwhile, below is the diff for the old sessions.py file and for the new one.

For people who don't understand how diff works, what you have to do is:
1) In the beginning of the sessions.py file add 'import string'
2) In the 'def Input(self)' method replace every instance of 'return message' with 'return self.CheckPrintable(message)'. There are two instances to replace, the first 'return ""' is not to be replaced.
3) Right after the end of that method, create a new one named 'def CheckPrintable(self,message)' and use the code located in the diff below for that method. BE CAREFULL WITH THE INDENTATION.


- ------------------------------------------------------------------------ - ------
3c3
< import messages,users
- ---
> import messages,users,string
67,68c67,68
< if message.endswith("\n"): return message
< else: return message
- ---
> if message.endswith("\n"): return self.CheckPrintable(message)
> else: return self.CheckPrintable(message) + self.Input()
71a72,77
>
> def CheckPrintable(self, message):
> printablemessage = ""
> for char in message.strip():
> if char in string.printable: printablemessage = printablemessage + char
> return printablemessage
- ------------------------------------------------------------------------ - ------
- -- Best Regards,
Daniel Alexandre ( dfcruz@xxxxxxxxxxxxxxxxx )
PGP Public Key: http://student.dei.uc.pt/~dfcruz/pubring.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)


iD8DBQFCJlvjL3+DjgQV3LgRApikAKDDU5g9GNp9emojx6kx7PGsLVklOwCdHvUk
bB856gZUSO2N/M240nfPBdk=
=Oj7H
-----END PGP SIGNATURE-----


Other related posts:

  • » [PyTalker]: Bug in 0.1.2 corrected!