From 44d41334d731e761eca122cd88b669aa959949d7 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Thu, 28 Jul 2011 10:27:52 +0200 Subject: [PATCH] [REF] osv: osv_memory is really just osv, the change is not enough as we still want to differentiate between regular osv and osv that should be wiped from the db from time to time. bzr revid: vmt@openerp.com-20110728082752-39jur9oo0m93ebzh --- openerp/addons/base/test/base_test.yml | 42 -------------------------- openerp/osv/orm.py | 2 +- openerp/osv/osv.py | 2 +- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/openerp/addons/base/test/base_test.yml b/openerp/addons/base/test/base_test.yml index 5a17ca108c3..6ea578a8659 100644 --- a/openerp/addons/base/test/base_test.yml +++ b/openerp/addons/base/test/base_test.yml @@ -144,45 +144,3 @@ !python {model: res.partner.category}: | self.pool._init = True -- - "OSV Memory: Verify that osv_memory properly handles large data allocation" -- - 1. No "count-based" auto-vaccuum when max_count is disabled -- - !python {model: base.language.export}: | - # setup special limits for the test, these will be reset at next pool reload anyway - self._max_count = None - num_recs = 250 - for i in xrange(num_recs): - self.create(cr, uid, {'format':'po'}) - assert (len(self.datas) >= num_recs), "OSV Memory must not auto-vaccum records from the current transaction if max_count is not set" -- - 2. Auto-vaccuum should be enabled when max_count is set -- - !python {model: base.language.export}: | - # setup special limits for the test, these will be reset at next pool reload anyway - self._max_count = 100 - num_recs = 219 - for i in xrange(num_recs): - self.create(cr, uid, {'name': i, 'format':'po'}) - assert (self._max_count <= len(self.datas) < self._max_count + self._check_time), "OSV Memory must auto-expire records when max_count is reached" - for k,v in self.datas.iteritems(): - assert (int(v['name']) >= (num_recs - (self._max_count + self._check_time))), "OSV Memory must auto-expire records based on age" -- - 3. Auto-vaccuum should be based on age only when max_count is not set -- - !python {model: base.language.export}: | - # setup special limits for the test, these will be reset at next pool reload anyway - self._max_count = None - self._max_hours = 0.01 #36 seconds - num_recs = 200 - for i in xrange(num_recs): - self.create(cr, uid, {'format':'po'}) - assert (len(self.datas) >= num_recs), "OSV Memory must not auto-expire records from the current transaction" - - # expire all records - for k,v in self.datas.iteritems(): - v['internal.date_access'] = 0 - self.vaccum(cr, 1, force=True) - - assert (len(self.datas) == 0), "OSV Memory must expire old records after vaccuum" diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index ff0d17af47a..850d88d8460 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -3380,7 +3380,7 @@ class orm(orm_template): # return _proxy - def fields_get(self, cr, user, fields=None, context=None): + def fields_get(self, cr, user, fields=None, context=None, write_access=True): """ Get the description of list of fields diff --git a/openerp/osv/osv.py b/openerp/osv/osv.py index 1327efe5731..c624bd7358f 100644 --- a/openerp/osv/osv.py +++ b/openerp/osv/osv.py @@ -199,7 +199,7 @@ class object_proxy(netsvc.Service): return res -class osv_memory(orm.orm_memory): +class osv_memory(orm.orm): """ Deprecated class. """ __metaclass__ = MetaModel _register = False # Set to false if the model shouldn't be automatically discovered.