[Spambayes-checkins] spambayes/Outlook2000 manager.py,1.78,1.79
Mark Hammond
mhammond at users.sourceforge.net
Sun Aug 24 23:33:26 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv6154
Modified Files:
manager.py
Log Message:
Fix [ 786952 ] Error when profile name has invalid filename characters
Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** manager.py 25 Aug 2003 04:22:35 -0000 1.78
--- manager.py 25 Aug 2003 05:33:23 -0000 1.79
***************
*** 22,25 ****
--- 22,32 ----
True, False = 1, 0
+ # Characters valid in a filename. Used to nuke bad chars from the profile
+ # name (which we try and use as a filename).
+ # We assume characters > 127 are OK as they may be unicode
+ filename_chars = ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '0123456789'
+ """$%'-_@~ `!()^#&+,;=[]""")
+
# Report a message to the user - should only be used for pretty serious errors
# hence we also print a traceback.
***************
*** 608,611 ****
--- 615,622 ----
profile_name = self.message_store.GetProfileName()
+ # The profile name may include characters invalid in file names.
+ if profile_name is not None:
+ profile_name = "".join([c for c in profile_name
+ if ord(c)>127 or c in filename_chars])
if profile_name is None:
# should only happen in source-code versions - older win32alls can't
More information about the Spambayes-checkins
mailing list