[Spambayes-checkins] spambayes/scripts sb_dbexpimp.py, 1.3,
1.4 sb_imapfilter.py, 1.16, 1.17 sb_notesfilter.py, 1.4,
1.5 sb_pop3dnd.py, 1.3, 1.4 sb_server.py, 1.13, 1.14
Tim Peters
tim_one at users.sourceforge.net
Tue Dec 16 00:06:36 EST 2003
- Previous message: [Spambayes-checkins] spambayes/contrib mod_spambayes.py,1.2,1.3
- Next message: [Spambayes-checkins] spambayes/spambayes Corpus.py, 1.11,
1.12 Dibbler.py, 1.10, 1.11 ImapUI.py, 1.29, 1.30 Options.py,
1.91, 1.92 OptionsClass.py, 1.20, 1.21 ProxyUI.py, 1.33,
1.34 ServerUI.py, 1.4, 1.5 UserInterface.py, 1.37,
1.38 dbmstorage.py, 1.10, 1.11 message.py, 1.44,
1.45 oe_mailbox.py, 1.2, 1.3 smtpproxy.py, 1.4, 1.5 storage.py,
1.36, 1.37 tokenizer.py, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv12349/scripts
Modified Files:
sb_dbexpimp.py sb_imapfilter.py sb_notesfilter.py
sb_pop3dnd.py sb_server.py
Log Message:
Whitespace normalization.
Index: sb_dbexpimp.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_dbexpimp.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sb_dbexpimp.py 26 Nov 2003 00:12:44 -0000 1.3
--- sb_dbexpimp.py 16 Dec 2003 05:06:33 -0000 1.4
***************
*** 11,35 ****
a spambayes database into/from a flat file. This is useful in a number
of scenarios.
!
Platform portability of database - flat files can be exported and
imported across platforms (winduhs and linux, for example)
!
Database implementation changes - databases can survive database
implementation upgrades or new database implementations. For example,
if a dbm implementation changes between python x.y and python x.y+1...
!
Database reorganization - an export followed by an import reorgs an
! existing database, <theoretically> improving performance, at least in
some database implementations
!
Database sharing - it is possible to distribute particular databases
for research purposes, database sharing purposes, or for new users to
have a 'seed' database to start with.
!
Database merging - multiple databases can be merged into one quite easily
by simply not specifying -n on an import. This will add the two database
nham and nspams together (assuming the two databases do not share corpora)
and for wordinfo conflicts, will add spamcount and hamcount together.
!
Spambayes software release migration - an export can be executed before
a release upgrade, as part of the installation script. Then, after the
--- 11,35 ----
a spambayes database into/from a flat file. This is useful in a number
of scenarios.
!
Platform portability of database - flat files can be exported and
imported across platforms (winduhs and linux, for example)
!
Database implementation changes - databases can survive database
implementation upgrades or new database implementations. For example,
if a dbm implementation changes between python x.y and python x.y+1...
!
Database reorganization - an export followed by an import reorgs an
! existing database, <theoretically> improving performance, at least in
some database implementations
!
Database sharing - it is possible to distribute particular databases
for research purposes, database sharing purposes, or for new users to
have a 'seed' database to start with.
!
Database merging - multiple databases can be merged into one quite easily
by simply not specifying -n on an import. This will add the two database
nham and nspams together (assuming the two databases do not share corpora)
and for wordinfo conflicts, will add spamcount and hamcount together.
!
Spambayes software release migration - an export can be executed before
a release upgrade, as part of the installation script. Then, after the
***************
*** 37,43 ****
effectively preserve existing training. This eliminates the need for
retraining every time a release is installed.
!
Others? I'm sure I haven't thought of everything...
!
Usage:
sb_dbexpimp [options]
--- 37,43 ----
effectively preserve existing training. This eliminates the need for
retraining every time a release is installed.
!
Others? I'm sure I haven't thought of everything...
!
Usage:
sb_dbexpimp [options]
***************
*** 61,75 ****
Export pickled mybayes.db into mybayes.db.export as a csv flat file
sb_dbexpimp -e -d mybayes.db -f mybayes.db.export
!
Import mybayes.eb.export into a new DBM mybayes.db
sb_dbexpimp -i -D mybayes.db -f mybayes.db.export
!
Export, then import (reorganize) new pickled mybayes.db
sb_dbexpimp -e -i -n -d mybayes.db -f mybayes.db.export
!
Convert a bayes database from pickle to DBM
sb_dbexpimp -e -d abayes.db -f abayes.export
sb_dbexpimp -i -D abayes.db -f abayes.export
!
Create a new database (newbayes.db) from two
databases (abayes.db, bbayes.db)
--- 61,75 ----
Export pickled mybayes.db into mybayes.db.export as a csv flat file
sb_dbexpimp -e -d mybayes.db -f mybayes.db.export
!
Import mybayes.eb.export into a new DBM mybayes.db
sb_dbexpimp -i -D mybayes.db -f mybayes.db.export
!
Export, then import (reorganize) new pickled mybayes.db
sb_dbexpimp -e -i -n -d mybayes.db -f mybayes.db.export
!
Convert a bayes database from pickle to DBM
sb_dbexpimp -e -d abayes.db -f abayes.export
sb_dbexpimp -i -D abayes.db -f abayes.export
!
Create a new database (newbayes.db) from two
databases (abayes.db, bbayes.db)
***************
*** 97,101 ****
# Maintain compatibility with Python 2.2
True, False = 1, 0
!
import spambayes.storage
from spambayes.Options import options
--- 97,101 ----
# Maintain compatibility with Python 2.2
True, False = 1, 0
!
import spambayes.storage
from spambayes.Options import options
***************
*** 126,140 ****
except IOError, e:
if e.errno != errno.ENOENT:
! raise
!
nham = bayes.nham;
nspam = bayes.nspam;
!
print "Exporting database %s to file %s" % (dbFN, outFN)
print "Database has %s ham, %s spam, and %s words" \
% (nham, nspam, len(words))
!
fp.write("%s,%s,\n" % (nham, nspam))
!
for word in words:
wi = bayes._wordinfoget(word)
--- 126,140 ----
except IOError, e:
if e.errno != errno.ENOENT:
! raise
!
nham = bayes.nham;
nspam = bayes.nspam;
!
print "Exporting database %s to file %s" % (dbFN, outFN)
print "Database has %s ham, %s spam, and %s words" \
% (nham, nspam, len(words))
!
fp.write("%s,%s,\n" % (nham, nspam))
!
for word in words:
wi = bayes._wordinfoget(word)
***************
*** 143,147 ****
word = uquote(word)
fp.write("%s`%s`%s`\n" % (word, hamcount, spamcount))
!
fp.close()
--- 143,147 ----
word = uquote(word)
fp.write("%s`%s`%s`\n" % (word, hamcount, spamcount))
!
fp.close()
***************
*** 154,158 ****
if e.errno != 2: # errno.<WHAT>
raise
!
try:
os.unlink(dbFN+".dat")
--- 154,158 ----
if e.errno != 2: # errno.<WHAT>
raise
!
try:
os.unlink(dbFN+".dat")
***************
*** 160,164 ****
if e.errno != 2: # errno.<WHAT>
raise
!
try:
os.unlink(dbFN+".dir")
--- 160,164 ----
if e.errno != 2: # errno.<WHAT>
raise
!
try:
os.unlink(dbFN+".dir")
***************
*** 166,170 ****
if e.errno != 2: # errno.<WHAT>
raise
!
if useDBM:
bayes = spambayes.storage.DBDictClassifier(dbFN)
--- 166,170 ----
if e.errno != 2: # errno.<WHAT>
raise
!
if useDBM:
bayes = spambayes.storage.DBDictClassifier(dbFN)
***************
*** 176,184 ****
except IOError, e:
if e.errno != errno.ENOENT:
! raise
!
nline = fp.readline()
(nham, nspam, junk) = re.split(',', nline)
!
if newDBM:
bayes.nham = int(nham)
--- 176,184 ----
except IOError, e:
if e.errno != errno.ENOENT:
! raise
!
nline = fp.readline()
(nham, nspam, junk) = re.split(',', nline)
!
if newDBM:
bayes.nham = int(nham)
***************
*** 187,204 ****
bayes.nham += int(nham)
bayes.nspam += int(nspam)
!
if newDBM:
impType = "Importing"
else:
impType = "Merging"
!
print "%s database %s using file %s" % (impType, dbFN, inFN)
lines = fp.readlines()
!
for line in lines:
(word, hamcount, spamcount, junk) = re.split('`', line)
word = uunquote(word)
!
try:
wi = bayes.wordinfo[word]
--- 187,204 ----
bayes.nham += int(nham)
bayes.nspam += int(nspam)
!
if newDBM:
impType = "Importing"
else:
impType = "Merging"
!
print "%s database %s using file %s" % (impType, dbFN, inFN)
lines = fp.readlines()
!
for line in lines:
(word, hamcount, spamcount, junk) = re.split('`', line)
word = uunquote(word)
!
try:
wi = bayes.wordinfo[word]
***************
*** 208,212 ****
wi.hamcount += int(hamcount)
wi.spamcount += int(spamcount)
!
bayes._wordinfoset(word, wi)
--- 208,212 ----
wi.hamcount += int(hamcount)
wi.spamcount += int(spamcount)
!
bayes._wordinfoset(word, wi)
***************
*** 217,221 ****
bayes.store()
print "Finished storing database"
!
if useDBM:
words = bayes.db.keys()
--- 217,221 ----
bayes.store()
print "Finished storing database"
!
if useDBM:
words = bayes.db.keys()
***************
*** 223,227 ****
else:
words = bayes.wordinfo.keys()
!
print "Database has %s ham, %s spam, and %s words" \
% (bayes.nham, bayes.nspam, len(words))
--- 223,227 ----
else:
words = bayes.wordinfo.keys()
!
print "Database has %s ham, %s spam, and %s words" \
% (bayes.nham, bayes.nspam, len(words))
Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** sb_imapfilter.py 15 Dec 2003 09:15:19 -0000 1.16
--- sb_imapfilter.py 16 Dec 2003 05:06:33 -0000 1.17
***************
*** 10,15 ****
sb_imapfilter [options]
! note: option values with spaces in them must be enclosed
! in double quotes
options:
--- 10,15 ----
sb_imapfilter [options]
! note: option values with spaces in them must be enclosed
! in double quotes
options:
***************
*** 31,35 ****
Classify inbox, with dbm database
sb_imapfilter -c -D bayes.db
!
Train Spam and Ham, then classify inbox, with dbm database
sb_imapfilter -t -c -D bayes.db
--- 31,35 ----
Classify inbox, with dbm database
sb_imapfilter -c -D bayes.db
!
Train Spam and Ham, then classify inbox, with dbm database
sb_imapfilter -t -c -D bayes.db
***************
*** 53,57 ****
mail flagged as such, *or* if you set the imap_expunge option to
True, then this mail will be irretrievably lost.
!
To Do:
o IMAPMessage and IMAPFolder currently carry out very simple checks
--- 53,57 ----
mail flagged as such, *or* if you set the imap_expunge option to
True, then this mail will be irretrievably lost.
!
To Do:
o IMAPMessage and IMAPFolder currently carry out very simple checks
***************
*** 181,185 ****
class IMAPSession(BaseIMAP):
'''A class extending the IMAP4 class, with a few optimizations'''
!
def __init__(self, server, port, debug=0, do_expunge=False):
try:
--- 181,185 ----
class IMAPSession(BaseIMAP):
'''A class extending the IMAP4 class, with a few optimizations'''
!
def __init__(self, server, port, debug=0, do_expunge=False):
try:
***************
*** 212,216 ****
raise
self.logged_in = True
!
def logout(self):
# sign off
--- 212,216 ----
raise
self.logged_in = True
!
def logout(self):
# sign off
***************
*** 230,234 ****
self.expunge()
BaseIMAP.logout(self) # superclass logout
!
def SelectFolder(self, folder):
'''A method to point ensuing imap operations at a target folder'''
--- 230,234 ----
self.expunge()
BaseIMAP.logout(self) # superclass logout
!
def SelectFolder(self, folder):
'''A method to point ensuing imap operations at a target folder'''
***************
*** 587,591 ****
move_opt_name]))
msg.Save()
! return num_trained
def Filter(self, classifier, spamfolder, unsurefolder):
--- 587,591 ----
move_opt_name]))
msg.Save()
! return num_trained
def Filter(self, classifier, spamfolder, unsurefolder):
***************
*** 621,629 ****
self.unsure_folder = IMAPFolder(options["imap", "unsure_folder"])
self.classifier = classifier
!
def Train(self):
if options["globals", "verbose"]:
t = time.time()
!
total_ham_trained = 0
total_spam_trained = 0
--- 621,629 ----
self.unsure_folder = IMAPFolder(options["imap", "unsure_folder"])
self.classifier = classifier
!
def Train(self):
if options["globals", "verbose"]:
t = time.time()
!
total_ham_trained = 0
total_spam_trained = 0
***************
*** 657,661 ****
if total_ham_trained or total_spam_trained:
self.classifier.store()
!
if options["globals", "verbose"]:
print "Training took %s seconds, %s messages were trained" \
--- 657,661 ----
if total_ham_trained or total_spam_trained:
self.classifier.store()
!
if options["globals", "verbose"]:
print "Training took %s seconds, %s messages were trained" \
***************
*** 673,677 ****
imap.SelectFolder(self.spam_folder.name)
imap.SelectFolder(self.unsure_folder.name)
!
for filter_folder in options["imap", "filter_folders"]:
# Select the folder to make sure it exists
--- 673,677 ----
imap.SelectFolder(self.spam_folder.name)
imap.SelectFolder(self.unsure_folder.name)
!
for filter_folder in options["imap", "filter_folders"]:
# Select the folder to make sure it exists
***************
*** 682,686 ****
for key in count.keys():
count[key] += subcount.get(key, 0)
!
if options["globals", "verbose"]:
if count is not None:
--- 682,686 ----
for key in count.keys():
count[key] += subcount.get(key, 0)
!
if options["globals", "verbose"]:
if count is not None:
***************
*** 689,693 ****
print "Classifying took", time.time() - t, "seconds."
!
def run():
global imap
--- 689,693 ----
print "Classifying took", time.time() - t, "seconds."
!
def run():
global imap
***************
*** 751,755 ****
bdbname = os.path.expanduser(bdbname)
!
if options["globals", "verbose"]:
print "Loading database %s..." % (bdbname),
--- 751,755 ----
bdbname = os.path.expanduser(bdbname)
!
if options["globals", "verbose"]:
print "Loading database %s..." % (bdbname),
***************
*** 758,762 ****
if options["globals", "verbose"]:
! print "Done."
if options["imap", "server"]:
--- 758,762 ----
if options["globals", "verbose"]:
! print "Done."
if options["imap", "server"]:
***************
*** 817,821 ****
imap.logout()
!
if sleepTime:
time.sleep(sleepTime)
--- 817,821 ----
imap.logout()
!
if sleepTime:
time.sleep(sleepTime)
Index: sb_notesfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_notesfilter.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sb_notesfilter.py 10 Nov 2003 20:21:52 -0000 1.4
--- sb_notesfilter.py 16 Dec 2003 05:06:33 -0000 1.5
***************
*** 10,14 ****
database. The Notes client must be running when this process is
executed.
!
It requires a Notes folder, named as a parameter, with four
subfolders:
--- 10,14 ----
database. The Notes client must be running when this process is
executed.
!
It requires a Notes folder, named as a parameter, with four
subfolders:
***************
*** 25,29 ****
3. Replicate (-r option)
4. Classify the inbox (-c option)
!
Mail that is to be trained as spam should be manually moved to
that folder by the user. Likewise mail that is to be trained as
--- 25,29 ----
3. Replicate (-r option)
4. Classify the inbox (-c option)
!
Mail that is to be trained as spam should be manually moved to
that folder by the user. Likewise mail that is to be trained as
***************
*** 65,69 ****
which if allowed to continue, would cause Spambayes to tend to
classify everything as Spam.
!
Because there is no programmatic way to determine if a particular
mail has been previously processed by this classification program,
--- 65,69 ----
which if allowed to continue, would cause Spambayes to tend to
classify everything as Spam.
!
Because there is no programmatic way to determine if a particular
mail has been previously processed by this classification program,
***************
*** 80,85 ****
sb_notesfilter [options]
! note: option values with spaces in them must be enclosed
! in double quotes
options:
--- 80,85 ----
sb_notesfilter [options]
! note: option values with spaces in them must be enclosed
! in double quotes
options:
***************
*** 108,118 ****
Replicate and classify inbox
sb_notesfilter -c -d notesbayes -r mynoteserv -l mail.nsf -f Spambayes
!
Train Spam and Ham, then classify inbox
sb_notesfilter -t -c -d notesbayes -l mail.nsf -f Spambayes
!
! Replicate, then classify inbox
sb_notesfilter -c -d test7 -l mail.nsf -r nynoteserv -f Spambayes
!
To Do:
o Dump/purge notesindex file
--- 108,118 ----
Replicate and classify inbox
sb_notesfilter -c -d notesbayes -r mynoteserv -l mail.nsf -f Spambayes
!
Train Spam and Ham, then classify inbox
sb_notesfilter -t -c -d notesbayes -l mail.nsf -f Spambayes
!
! Replicate, then classify inbox
sb_notesfilter -c -d test7 -l mail.nsf -r nynoteserv -f Spambayes
!
To Do:
o Dump/purge notesindex file
***************
*** 159,163 ****
else:
firsttime = 0
!
docstomove = []
numham = 0
--- 159,163 ----
else:
firsttime = 0
!
docstomove = []
numham = 0
***************
*** 165,174 ****
numuns = 0
numdocs = 0
!
doc = v.GetFirstDocument()
while doc:
nid = doc.NOTEID
if firsttime:
! notesindex[nid] = 'never classified'
else:
if not notesindex.has_key(nid):
--- 165,174 ----
numuns = 0
numdocs = 0
!
doc = v.GetFirstDocument()
while doc:
nid = doc.NOTEID
if firsttime:
! notesindex[nid] = 'never classified'
else:
if not notesindex.has_key(nid):
***************
*** 182,186 ****
# The com interface returns basic data types as tuples
# only, thus the subscript on GetItemValue
!
try:
subj = doc.GetItemValue('Subject')[0]
--- 182,186 ----
# The com interface returns basic data types as tuples
# only, thus the subscript on GetItemValue
!
try:
subj = doc.GetItemValue('Subject')[0]
***************
*** 230,234 ****
print " %s classified as ham" % (numham)
print " %s classified as unsure" % (numuns)
!
def processAndTrain(v, vmoveto, bayes, is_spam, notesindex):
--- 230,234 ----
print " %s classified as ham" % (numham)
print " %s classified as unsure" % (numuns)
!
def processAndTrain(v, vmoveto, bayes, is_spam, notesindex):
***************
*** 240,244 ****
print "Training %s" % (str)
!
docstomove = []
doc = v.GetFirstDocument()
--- 240,244 ----
print "Training %s" % (str)
!
docstomove = []
doc = v.GetFirstDocument()
***************
*** 253,257 ****
except:
body = 'No Body'
!
message = "Subject: %s\r\n%s" % (subj, body)
--- 253,257 ----
except:
body = 'No Body'
!
message = "Subject: %s\r\n%s" % (subj, body)
***************
*** 270,274 ****
# msg is trained as ham, is to be retrained as spam
bayes.unlearn(tokens, False)
!
bayes.learn(tokens, is_spam)
--- 270,274 ----
# msg is trained as ham, is to be retrained as spam
bayes.unlearn(tokens, False)
!
bayes.learn(tokens, is_spam)
***************
*** 282,286 ****
print "%s documents trained" % (len(docstomove))
!
def run(bdbname, useDBM, ldbname, rdbname, foldname, doTrain, doClassify):
--- 282,286 ----
print "%s documents trained" % (len(docstomove))
!
def run(bdbname, useDBM, ldbname, rdbname, foldname, doTrain, doClassify):
***************
*** 302,306 ****
notesindex = pickle.load(fp)
fp.close()
!
sess = win32com.client.Dispatch("Lotus.NotesSession")
try:
--- 302,306 ----
notesindex = pickle.load(fp)
fp.close()
!
sess = win32com.client.Dispatch("Lotus.NotesSession")
try:
***************
*** 309,315 ****
print "Session aborted"
sys.exit()
!
db = sess.GetDatabase("",ldbname)
!
vinbox = db.getView('($Inbox)')
vspam = db.getView("%s\Spam" % (foldname))
--- 309,315 ----
print "Session aborted"
sys.exit()
!
db = sess.GetDatabase("",ldbname)
!
vinbox = db.getView('($Inbox)')
vspam = db.getView("%s\Spam" % (foldname))
***************
*** 317,331 ****
vtrainspam = db.getView("%s\Train as Spam" % (foldname))
vtrainham = db.getView("%s\Train as Ham" % (foldname))
!
if doTrain:
processAndTrain(vtrainspam, vspam, bayes, True, notesindex)
# for some reason, using inbox as a target here loses the mail
processAndTrain(vtrainham, vham, bayes, False, notesindex)
!
if rdbname:
print "Replicating..."
db.Replicate(rdbname)
print "Done"
!
if doClassify:
classifyInbox(vinbox, vtrainspam, bayes, ldbname, notesindex)
--- 317,331 ----
vtrainspam = db.getView("%s\Train as Spam" % (foldname))
vtrainham = db.getView("%s\Train as Ham" % (foldname))
!
if doTrain:
processAndTrain(vtrainspam, vspam, bayes, True, notesindex)
# for some reason, using inbox as a target here loses the mail
processAndTrain(vtrainham, vham, bayes, False, notesindex)
!
if rdbname:
print "Replicating..."
db.Replicate(rdbname)
print "Done"
!
if doClassify:
classifyInbox(vinbox, vtrainspam, bayes, ldbname, notesindex)
***************
*** 339,343 ****
pickle.dump(notesindex, fp)
fp.close()
!
if __name__ == '__main__':
--- 339,343 ----
pickle.dump(notesindex, fp)
fp.close()
!
if __name__ == '__main__':
***************
*** 390,392 ****
pass
else:
! print >>sys.stderr, __doc__
\ No newline at end of file
--- 390,392 ----
pass
else:
! print >>sys.stderr, __doc__
Index: sb_pop3dnd.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_pop3dnd.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sb_pop3dnd.py 18 Sep 2003 03:58:59 -0000 1.3
--- sb_pop3dnd.py 16 Dec 2003 05:06:33 -0000 1.4
***************
*** 172,176 ****
return self._flags_iter()
! def _flags_iter(self):
if self.deleted:
yield "\\DELETED"
--- 172,176 ----
return self._flags_iter()
! def _flags_iter(self):
if self.deleted:
yield "\\DELETED"
***************
*** 209,216 ****
def getSubPart(self, part):
"""Retrieve a MIME sub-message
!
@type part: C{int}
@param part: The number of the part to retrieve, indexed from 0.
!
@rtype: Any object implementing C{IMessage}.
@return: The specified sub-part.
--- 209,216 ----
def getSubPart(self, part):
"""Retrieve a MIME sub-message
!
@type part: C{int}
@param part: The number of the part to retrieve, indexed from 0.
!
@rtype: Any object implementing C{IMessage}.
@return: The specified sub-part.
***************
*** 243,247 ****
else:
print "Tried to set invalid flag", flag, "to", value
!
def flags(self):
"""Return the message flags."""
--- 243,247 ----
else:
print "Tried to set invalid flag", flag, "to", value
!
def flags(self):
"""Return the message flags."""
***************
*** 273,277 ****
"""Body structure data describes the MIME-IMB
format of a message and consists of a sequence of mime type, mime
! subtype, parameters, content id, description, encoding, and size.
The fields following the size field are variable: if the mime
type/subtype is message/rfc822, the contained message's envelope
--- 273,277 ----
"""Body structure data describes the MIME-IMB
format of a message and consists of a sequence of mime type, mime
! subtype, parameters, content id, description, encoding, and size.
The fields following the size field are variable: if the mime
type/subtype is message/rfc822, the contained message's envelope
***************
*** 307,311 ****
return s
! def body(self):
rfc822 = self.as_string()
bodyRE = re.compile(r"\r?\n(\r?\n)(.*)",
--- 307,311 ----
return s
! def body(self):
rfc822 = self.as_string()
bodyRE = re.compile(r"\r?\n(\r?\n)(.*)",
***************
*** 333,337 ****
def string_contains(self, whole, sub):
return whole.find(sub) != -1
!
def matches(self, criteria):
"""Return True iff the messages matches the specified IMAP
--- 333,337 ----
def string_contains(self, whole, sub):
return whole.find(sub) != -1
!
def matches(self, criteria):
"""Return True iff the messages matches the specified IMAP
***************
*** 368,372 ****
"SINCE" : (self.since, self.date),
}
!
result = True
test = None
--- 368,372 ----
"SINCE" : (self.since, self.date),
}
!
result = True
test = None
***************
*** 437,441 ****
"""Add a mailbox change listener."""
self.listeners.append(listener)
!
def removeListener(self, listener):
"""Remove a mailbox change listener."""
--- 437,441 ----
"""Add a mailbox change listener."""
self.listeners.append(listener)
!
def removeListener(self, listener):
"""Remove a mailbox change listener."""
***************
*** 465,469 ****
if msg.recent:
self.recent_count += 1
!
def getUIDNext(self, increase=False):
"""Return the likely UID for the next message added to this
--- 465,469 ----
if msg.recent:
self.recent_count += 1
!
def getUIDNext(self, increase=False):
"""Return the likely UID for the next message added to this
***************
*** 496,500 ****
"""Return the number of messages with the 'Unseen' flag."""
return self.unseen_count
!
def isWriteable(self):
"""Get the read/write status of the mailbox."""
--- 496,500 ----
"""Return the number of messages with the 'Unseen' flag."""
return self.unseen_count
!
def isWriteable(self):
"""Get the read/write status of the mailbox."""
***************
*** 584,588 ****
matches.append(id)
break
! return matches
def _messagesIter(self, messages, uid):
--- 584,588 ----
matches.append(id)
break
! return matches
def _messagesIter(self, messages, uid):
***************
*** 641,645 ****
# We don't care
pass
!
def flagsChanged(self, newFlags):
# We don't care
--- 641,645 ----
# We don't care
pass
!
def flagsChanged(self, newFlags):
# We don't care
***************
*** 811,815 ****
date = imaplib.Time2Internaldate(time.time())[1:-1]
dest_folder.addMessage(msg, (), date)
!
# We have to return something, because the client is expecting
# us to. We return a short message indicating that a message
--- 811,815 ----
date = imaplib.Time2Internaldate(time.time())[1:-1]
dest_folder.addMessage(msg, (), date)
!
# We have to return something, because the client is expecting
# us to. We return a short message indicating that a message
***************
*** 899,903 ****
httpServer.register(serverUI)
! return app
def run():
--- 899,903 ----
httpServer.register(serverUI)
! return app
def run():
Index: sb_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_server.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** sb_server.py 14 Dec 2003 01:30:49 -0000 1.13
--- sb_server.py 16 Dec 2003 05:06:33 -0000 1.14
***************
*** 505,509 ****
traceback.print_exc(None, stream)
details = stream.getvalue()
!
# Build the header. This will strip leading whitespace from
# the lines, so we add a leading dot to maintain indentation.
--- 505,509 ----
traceback.print_exc(None, stream)
details = stream.getvalue()
!
# Build the header. This will strip leading whitespace from
# the lines, so we add a leading dot to maintain indentation.
***************
*** 512,516 ****
headerName = 'X-Spambayes-Exception'
header = Header(dottedDetails, header_name=headerName)
!
# Insert the header, converting email.Header's '\n' line
# breaks to POP3's '\r\n'.
--- 512,516 ----
headerName = 'X-Spambayes-Exception'
header = Header(dottedDetails, header_name=headerName)
!
# Insert the header, converting email.Header's '\n' line
# breaks to POP3's '\r\n'.
***************
*** 676,684 ****
assert self.platform_mutex is None, "Should not already have the mutex"
self.platform_mutex = open_platform_mutex()
!
# Do whatever we've been asked to do...
self.createWorkers()
self.prepared = True
!
def buildServerStrings(self):
"""After the server details have been set up, this creates string
--- 676,684 ----
assert self.platform_mutex is None, "Should not already have the mutex"
self.platform_mutex = open_platform_mutex()
!
# Do whatever we've been asked to do...
self.createWorkers()
self.prepared = True
!
def buildServerStrings(self):
"""After the server details have been set up, this creates string
***************
*** 713,717 ****
big = "spam"
small = "ham"
! if big is not None:
self.warning = "Warning: you have much more %s than %s - " \
"SpamBayes works best with approximately even " \
--- 713,717 ----
big = "spam"
small = "ham"
! if big is not None:
self.warning = "Warning: you have much more %s than %s - " \
"SpamBayes works best with approximately even " \
***************
*** 919,923 ****
elif len(args) == 2:
state.servers = [(args[0], int(args[1]))]
!
# Default to listening on port 110 for command-line-specified servers.
if len(args) > 0 and state.proxyPorts == []:
--- 919,923 ----
elif len(args) == 2:
state.servers = [(args[0], int(args[1]))]
!
# Default to listening on port 110 for command-line-specified servers.
if len(args) > 0 and state.proxyPorts == []:
- Previous message: [Spambayes-checkins] spambayes/contrib mod_spambayes.py,1.2,1.3
- Next message: [Spambayes-checkins] spambayes/spambayes Corpus.py, 1.11,
1.12 Dibbler.py, 1.10, 1.11 ImapUI.py, 1.29, 1.30 Options.py,
1.91, 1.92 OptionsClass.py, 1.20, 1.21 ProxyUI.py, 1.33,
1.34 ServerUI.py, 1.4, 1.5 UserInterface.py, 1.37,
1.38 dbmstorage.py, 1.10, 1.11 message.py, 1.44,
1.45 oe_mailbox.py, 1.2, 1.3 smtpproxy.py, 1.4, 1.5 storage.py,
1.36, 1.37 tokenizer.py, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Spambayes-checkins
mailing list