Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16141/spambayes
Modified Files: Tag: CORESVR CoreUI.py ProxyUI.py UserInterface.py Log Message: trivial refactoring (these should probably both be functions, not methods) Index: CoreUI.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/Attic/CoreUI.py,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** CoreUI.py 6 Jun 2007 03:30:45 -0000 1.1.2.7 --- CoreUI.py 8 Jun 2007 02:09:51 -0000 1.1.2.8 *************** *** 206,226 **** self.write(_("<p>OK. Return <a href='home'>Home</a>.</p>")) - def _keyToTimestamp(self, key): - """Given a message key (as seen in a Corpus), returns the timestamp - for that message. This is the time that the message was received, - not the Date header.""" - return long(key[:10]) - - def _getTimeRange(self, timestamp): - """Given a unix timestamp, returns a 3-tuple: the start timestamp - of the given day, the end timestamp of the given day, and the - formatted date of the given day.""" - this = time.localtime(timestamp) - start = (this[0], this[1], this[2], 0, 0, 0, this[6], this[7], this[8]) - end = time.localtime(time.mktime(start) + 36*60*60) - end = (end[0], end[1], end[2], 0, 0, 0, end[6], end[7], end[8]) - date = time.strftime("%A, %B %d, %Y", start) - return time.mktime(start), time.mktime(end), date - def _buildReviewKeys(self, timestamp): """Builds an ordered list of untrained message keys, ready for output --- 206,209 ---- Index: ProxyUI.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/ProxyUI.py,v retrieving revision 1.64.2.1 retrieving revision 1.64.2.2 diff -C2 -d -r1.64.2.1 -r1.64.2.2 *** ProxyUI.py 6 Jun 2007 03:31:25 -0000 1.64.2.1 --- ProxyUI.py 8 Jun 2007 02:09:51 -0000 1.64.2.2 *************** *** 111,115 **** ) ! # Like the above, but hese are the options that will be offered on the # advanced configuration page. adv_map = ( --- 111,115 ---- ) ! # Like the above, but these are the options that will be offered on the # advanced configuration page. adv_map = ( *************** *** 221,241 **** self.write(_("<p>OK. Return <a href='home'>Home</a>.</p>")) - def _keyToTimestamp(self, key): - """Given a message key (as seen in a Corpus), returns the timestamp - for that message. This is the time that the message was received, - not the Date header.""" - return long(key[:10]) - - def _getTimeRange(self, timestamp): - """Given a unix timestamp, returns a 3-tuple: the start timestamp - of the given day, the end timestamp of the given day, and the - formatted date of the given day.""" - this = time.localtime(timestamp) - start = (this[0], this[1], this[2], 0, 0, 0, this[6], this[7], this[8]) - end = time.localtime(time.mktime(start) + 36*60*60) - end = (end[0], end[1], end[2], 0, 0, 0, end[6], end[7], end[8]) - date = time.strftime("%A, %B %d, %Y", start) - return time.mktime(start), time.mktime(end), date - def _buildReviewKeys(self, timestamp): """Builds an ordered list of untrained message keys, ready for output --- 221,224 ---- Index: UserInterface.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v retrieving revision 1.61.2.1 retrieving revision 1.61.2.2 diff -C2 -d -r1.61.2.1 -r1.61.2.2 *** UserInterface.py 24 May 2007 03:19:34 -0000 1.61.2.1 --- UserInterface.py 8 Jun 2007 02:09:51 -0000 1.61.2.2 *************** *** 1253,1254 **** --- 1253,1273 ---- lines.append(''.join(cur_line)) return lines + + def _keyToTimestamp(self, key): + """Given a message key (as seen in a Corpus), returns the timestamp + for that message. This is the time that the message was received, + not the Date header.""" + return long(key[:10]) + + def _getTimeRange(self, timestamp): + """Given a unix timestamp, returns a 3-tuple: the start timestamp + of the given day, the end timestamp of the given day, and the + formatted date of the given day.""" + this = time.localtime(timestamp) + start = (this[0], this[1], this[2], 0, 0, 0, this[6], this[7], this[8]) + end = time.localtime(time.mktime(start) + 36*60*60) + end = (end[0], end[1], end[2], 0, 0, 0, end[6], end[7], end[8]) + date = time.strftime("%A, %B %d, %Y", start) + return time.mktime(start), time.mktime(end), date + + _______________________________________________ Spambayes-checkins mailing list Spambayes-checkins@python.org http://mail.python.org/mailman/listinfo/spambayes-checkins