regression: wild copy of context that can actually be None in ir_model.py

Bug #525962 reported by Raphaël Valyi - http://www.akretion.com
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
High
Unassigned

Bug Description

Hello,

In commit #1963 of server 5.0, you changed code inside the ir.model#create method.
Now you do a brutal context.copy() while by default the optional context argument is set to None in the create method signature (around line 83).
One of the examples where it breaks existing code is the Magento Connector magentoerpconnect module , but it's easy to imagine it could easily break in many other cases.
So please do a defensive check of the context before assuming it's not None or either set it to {} by default, I don't know what is better, but the current code is flawed, that's for sure.

Hope this helps

Related branches

Changed in openobject-server:
importance: Undecided → High
milestone: none → 5.0.7
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

You were right Raphael.
Its rare, but it was needed to be fixed.
Fixed by revision 1985 <email address hidden>.
Thank you.

Changed in openobject-server:
status: New → Confirmed
status: Confirmed → Fix Released
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : Re: [Bug 525962] Re: regression: wild copy of context that can actually be None in ir_model.py

Thanks

On Tue, Feb 23, 2010 at 3:06 AM, Jay (Open ERP) <email address hidden> wrote:

> You were right Raphael.
> Its rare, but it was needed to be fixed.
> Fixed by revision 1985 <email address hidden>.
> Thank you.
>
>
> ** Changed in: openobject-server
> Status: Confirmed => Fix Released
>
> --
> regression: wild copy of context that can actually be None in ir_model.py
> https://bugs.launchpad.net/bugs/525962
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in OpenObject Server: Fix Released
>
> Bug description:
> Hello,
>
> In commit #1963 of server 5.0, you changed code inside the ir.model#create
> method.
> Now you do a brutal context.copy() while by default the optional context
> argument is set to None in the create method signature (around line 83).
> One of the examples where it breaks existing code is the Magento Connector
> magentoerpconnect module , but it's easy to imagine it could easily break in
> many other cases.
> So please do a defensive check of the context before assuming it's not None
> or either set it to {} by default, I don't know what is better, but the
> current code is flawed, that's for sure.
>
> Hope this helps
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/openobject-server/+bug/525962/+subscribe
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.