Пример #1
0
 def _probe_bounce(self, mlist, token):
     locked = mlist.Locked()
     if not locked:
         mlist.Lock()
     try:
         op, addr, bmsg = mlist.pend_confirm(token)
         # For Python 2.4 compatibility we need an inner try because
         # try: ... except: ... finally: requires Python 2.5+
         try:
             info = mlist.getBounceInfo(addr)
             if not info:
                 # info was deleted before probe bounce was received.
                 # Just create a new info.
                 info = _BounceInfo(addr, 0.0,
                                    time.localtime()[:3],
                                    mlist.bounce_you_are_disabled_warnings)
             mlist.disableBouncingMember(addr, info, bmsg)
             # Only save the list if we're unlocking it
             if not locked:
                 mlist.Save()
         except NotAMemberError:
             # Member was removed before probe bounce returned.
             # Just ignore it.
             pass
     finally:
         if not locked:
             mlist.Unlock()
Пример #2
0
 def getBounceInfo(self, member):
     self.query("""SELECT
         bi_score,
         bi_noticesleft,
         YEAR(bi_lastnotice),
         MONTH(bi_lastnotice),
         DAYOFMONTH(bi_lastnotice),
         YEAR(bi_date),
         MONTH(bi_date),
         DAYOFMONTH(bi_date),
         bi_cookie
         FROM `%s` WHERE %s AND """ % (self._table, self._where) +
                ("address = '%s'" % (self.escape(member))))
     numrows = int(mm_cfg.cursor.rowcount)
     if numrows is 0:
         self.__assertIsMember(member)
     row = mm_cfg.cursor.fetchone()
     # We must not return a _BounceInfo instance if there is no bounce info
     # to start with.
     if row[3] <= 0:
         return None
     # Otherwise, populate a bounce_info structure.
     bounce_info = _BounceInfo(member, row[0], (row[5], row[6], row[7]),
                               row[1])
     bounce_info.lastnotice = (row[2], row[3], row[4])
     bounce_info.cookie = row[8]
     return bounce_info
Пример #3
0
 def getBounceInfo(self, member):
     self.query("""SELECT
         bi_score,
         bi_noticesleft,
         YEAR(bi_lastnotice),
         MONTH(bi_lastnotice),
         DAYOFMONTH(bi_lastnotice),
         YEAR(bi_date),
         MONTH(bi_date),
         DAYOFMONTH(bi_date),
         bi_cookie
         FROM `%s` WHERE %s AND """ %(self._table, self._where)
         + ("address = '%s'" %( self.escape(member) ) ))
     numrows = int(mm_cfg.cursor.rowcount)
     if numrows is 0:
         self.__assertIsMember(member)
     row = mm_cfg.cursor.fetchone()
     # We must not return a _BounceInfo instance if there is no bounce info
     # to start with.
     if row[3] <= 0:
         return None;
     # Otherwise, populate a bounce_info structure.
     bounce_info = _BounceInfo(member, row[0],
         (row[5],row[6],row[7]), row[1])
     bounce_info.lastnotice = (row[2],row[3],row[4])
     bounce_info.cookie = row[8]
     return bounce_info
 def _probe_bounce(self, mlist, token):
     locked = mlist.Locked()
     if not locked:
         mlist.Lock()
     try:
         op, addr, bmsg = mlist.pend_confirm(token)
         # For Python 2.4 compatibility we need an inner try because
         # try: ... except: ... finally: requires Python 2.5+
         try:
             info = mlist.getBounceInfo(addr)
             if not info:
                 # info was deleted before probe bounce was received.
                 # Just create a new info.
                 info = _BounceInfo(addr,
                                    0.0,
                                    time.localtime()[:3],
                                    mlist.bounce_you_are_disabled_warnings
                                    )
             mlist.disableBouncingMember(addr, info, bmsg)
             # Only save the list if we're unlocking it
             if not locked:
                 mlist.Save()
         except NotAMemberError:
             # Member was removed before probe bounce returned.
             # Just ignore it.
             pass
     finally:
         if not locked:
             mlist.Unlock()