← Back to team overview

openerp-india team mailing list archive

[Bug 1082632] [NEW] [6.1] write in mail.message fails because of non existing variable in fetchmail overriding function

 

Public bug reported:

When calling mail_message.send, the call fails because fetchmail.py
overrides the mail_message.write function with a function containing a
not existing variable.

Error in log:
  File "/home/openeyedev/var/openerp/addons_6.1/mail/mail_message.py", line 502, in send
    self.write(cr, uid, ids, {'state': 'outgoing'}, context=context)
NameError: global name 'server_id' is not defined

These kind of errors should never happen if modern IDE's were used that
would catch these errors immediately.

Anyway below is the failing part of the code:

    def write(self, cr, uid, ids, values, context=None):
        if context is None:
            context={}
        fetchmail_server_id = context.get('fetchmail_server_id')
        if fetchmail_server_id:
            values['fetchmail_server_id'] = server_id
        res = super(mail_message,self).write(cr, uid, ids, values, context=context)
        return res

The variable server_id in the third line from below does not exist. it
should be fetchmail_server_id.

This has been fixed in trunk / 7.0 in revision r8037, but left unchanged
in 6.1.

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

** Patch added: "Solve bug with non existing variable"
   https://bugs.launchpad.net/bugs/1082632/+attachment/3442749/+files/fetchmail.patch

** Description changed:

  When calling mail_message.send, the call fails because fetchmail.py
  overrides the mail_message.write function with a function containing a
  not existing variable.
  
  Error in log:
-   File "/home/openeyedev/var/openerp/addons_6.1/mail/mail_message.py", line 502, in send
-     self.write(cr, uid, ids, {'state': 'outgoing'}, context=context)
+   File "/home/openeyedev/var/openerp/addons_6.1/mail/mail_message.py", line 502, in send
+     self.write(cr, uid, ids, {'state': 'outgoing'}, context=context)
  NameError: global name 'server_id' is not defined
  
- These kind of errors should never happen in moder IDE's were used that
+ These kind of errors should never happen if modern IDE's were used that
  would catch these errors immediately.
  
  Anyway below is the failing part of the code:
  
-     def write(self, cr, uid, ids, values, context=None):
-         if context is None:
-             context={}
-         fetchmail_server_id = context.get('fetchmail_server_id')
-         if fetchmail_server_id:
-             values['fetchmail_server_id'] = server_id
-         res = super(mail_message,self).write(cr, uid, ids, values, context=context)
-         return res
+     def write(self, cr, uid, ids, values, context=None):
+         if context is None:
+             context={}
+         fetchmail_server_id = context.get('fetchmail_server_id')
+         if fetchmail_server_id:
+             values['fetchmail_server_id'] = server_id
+         res = super(mail_message,self).write(cr, uid, ids, values, context=context)
+         return res
  
  The variable server_id in the third line from below does not exist. it
  should be fetchmail_server_id.
  
  This has been fixed in trunk / 7.0 in revision r8037, but left unchanged
  in 6.1.

-- 
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/1082632

Title:
  [6.1] write in mail.message fails because of non existing variable in
  fetchmail overriding function

Status in OpenERP Addons (modules):
  New

Bug description:
  When calling mail_message.send, the call fails because fetchmail.py
  overrides the mail_message.write function with a function containing a
  not existing variable.

  Error in log:
    File "/home/openeyedev/var/openerp/addons_6.1/mail/mail_message.py", line 502, in send
      self.write(cr, uid, ids, {'state': 'outgoing'}, context=context)
  NameError: global name 'server_id' is not defined

  These kind of errors should never happen if modern IDE's were used
  that would catch these errors immediately.

  Anyway below is the failing part of the code:

      def write(self, cr, uid, ids, values, context=None):
          if context is None:
              context={}
          fetchmail_server_id = context.get('fetchmail_server_id')
          if fetchmail_server_id:
              values['fetchmail_server_id'] = server_id
          res = super(mail_message,self).write(cr, uid, ids, values, context=context)
          return res

  The variable server_id in the third line from below does not exist. it
  should be fetchmail_server_id.

  This has been fixed in trunk / 7.0 in revision r8037, but left
  unchanged in 6.1.

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


Follow ups

References