← Back to team overview

openerp-india team mailing list archive

[Bug 988743] Re: Invalid lookup in ormcache()

 

Hello,

Thibaut is perfectly right, this is apparently a typo that makes the system store cached data with the wrong key whenever skiparg != 2. This basically disables the cache and makes it useless for those cases.
In particular our translation system is affected, because ir.transalation.get_source() uses skiparg=3, so it means the cache does not work for translations at the moment.
This should not cause any bug, but makes the cache system useless in those cases, and might have an impact on performance.

Jignesh, if you want to convince yourself the easiest method is probably to add a print statement after line 46 of tools.cache, and then open any menu in your OpenERP client (e.g Customer list). When you click on the same menu again you should not see any printed lines because all translations should be cached... but in fact you will see them again, and every time you refresh.
Now if you replace d[args] with d[key] on line 46 and try again, you will see that it works as expected.

The fix will be applied soon, however I'd love to have a unit test for
this... writing one is quite easy as we have a cache miss counter
already.

** Changed in: openobject-server
   Importance: Undecided => Medium

** Changed in: openobject-server
       Status: Incomplete => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

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

Title:
  Invalid lookup in ormcache()

Status in OpenERP Server:
  Confirmed

Bug description:
  Hi,

  In ormcache(), you check if the data is present using the "key"
  variable, and you define it using "args" [1], which is not the same.
  The first one is based on self.skiparg, whereas the second is not.

  So, for decorators which set the "skiparg" arguments, if it is
  different of 2, the cache won't work. The fix is simply to set d[key]
  inseatd of d[args].

  [1] : http://bazaar.launchpad.net/~openerp/openobject-
  server/trunk/view/head:/openerp/tools/cache.py#L46

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


References