← Back to team overview

openerp-india team mailing list archive

[Bug 1081101] [NEW] mail_thread.py hangs sometimes because of non empty list

 

Public bug reported:

    def message_thread_followers(self, cr, uid, ids, context=None):
        """Returns a list of email addresses of the people following
           this thread, including the sender of each mail, and the
           people who were in CC of the messages, if any.
        """
        
        res = {}
        if isinstance(ids, (str, int, long)):
            ids = [long(ids)] # sometimes the result is [ None ]

        ids = [id for id in ids if id != None] # add this to remove None

        for thread in self.browse(cr, uid, ids, context=context):
            l = set()
            for message in thread.message_ids:
                l.add((message.user_id and message.user_id.user_email) or '')
                l.add(message.email_from or '')
                l.add(message.email_cc or '')
            res[thread.id] = filter(None, l)
        return res


### the same holds for this part of the file mail_thread.py:


    def message_forward(self, cr, uid, model, thread_ids, msg, email_error=False, context=None):
        """Sends an email to all people following the given threads.
           The emails are forwarded immediately, not queued for sending,
           and not archived.

        :param str model: thread model
        :param list thread_ids: ids of the thread records
        :param msg: email.message.Message object to forward
        :param email_error: optional email address to notify in case
                            of any delivery error during the forward.
        :return: True
        """
        model_pool = self.pool.get(model)
        smtp_server_obj = self.pool.get('ir.mail_server')


        thread_ids = [id for id in thread_ids if id != None] # add this to remove None        
        
        for res in model_pool.browse(cr, uid, thread_ids, context=context):

** Affects: openobject-addons
     Importance: Undecided
         Status: New


** Tags: mail parsing

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1081101

Title:
  mail_thread.py hangs sometimes because of non empty list

Status in OpenERP Addons (modules):
  New

Bug description:
      def message_thread_followers(self, cr, uid, ids, context=None):
          """Returns a list of email addresses of the people following
             this thread, including the sender of each mail, and the
             people who were in CC of the messages, if any.
          """
          
          res = {}
          if isinstance(ids, (str, int, long)):
              ids = [long(ids)] # sometimes the result is [ None ]

          ids = [id for id in ids if id != None] # add this to remove
  None

          for thread in self.browse(cr, uid, ids, context=context):
              l = set()
              for message in thread.message_ids:
                  l.add((message.user_id and message.user_id.user_email) or '')
                  l.add(message.email_from or '')
                  l.add(message.email_cc or '')
              res[thread.id] = filter(None, l)
          return res


  
  ### the same holds for this part of the file mail_thread.py:

  
      def message_forward(self, cr, uid, model, thread_ids, msg, email_error=False, context=None):
          """Sends an email to all people following the given threads.
             The emails are forwarded immediately, not queued for sending,
             and not archived.

          :param str model: thread model
          :param list thread_ids: ids of the thread records
          :param msg: email.message.Message object to forward
          :param email_error: optional email address to notify in case
                              of any delivery error during the forward.
          :return: True
          """
          model_pool = self.pool.get(model)
          smtp_server_obj = self.pool.get('ir.mail_server')

  
          thread_ids = [id for id in thread_ids if id != None] # add this to remove None        
          
          for res in model_pool.browse(cr, uid, thread_ids, context=context):

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1081101/+subscriptions


Follow ups

References