Commit Graph

68 Commits

Author SHA1 Message Date
Christophe Simonis 04b252b72c [FIX] Cursor.closed property
`_obj` doesn't exists anymore when the cursor is effectively closed.
2015-05-11 16:24:33 +02:00
Christophe Simonis 1b5576af46 [FIX] sql_db: add `closed` property on `Cursor`. 2015-05-08 16:50:15 +02:00
Denis Ledoux cf4d14ce39 [MERGE] forward port of branch saas-3 up to 09b277c 2015-04-27 14:02:52 +02:00
Denis Ledoux d6ae7fb7db [MERGE] forward port of branch 7.0 up to 3e7d3c7 2015-04-27 12:19:43 +02:00
dhr-odoo cb5f00f580 [FIX] orm: ordering on >1000 records
When reading over IN_MAX (currently 1000) records, the select is slip into
subsets of IN_MAX records. However the list of ids was split using set() method
which removes order that may have been pass. The subsets are ordered using
_order attribute but the subsets were not ordered between themself.
This is an issue in case of browsing a o2m field with more than 1000 lines as it
will return sorted blocked but the order of the blocks is the order of the
contained ids (e.g. split(2, [5, 4, 3, 2, 1]) -> [[2,1], [4,3], [5]]).

Removes the set() to make sure the order of the given ids is preserved.
opw 616070, linked to #439
2015-04-22 12:14:33 +02:00
Denis Ledoux a175ed6b2f [MERGE] forward port of branch saas-3 up to 30674c3 2014-12-23 14:03:38 +01:00
Denis Ledoux 30674c3ed6 [MERGE] forward port of branch 7.0 up to e151e8f 2014-12-23 13:50:25 +01:00
Cedric Le Brouster 8f30ab04be [FIX] sql_db: close db connexions before removing them.
Closes #831 aka lp 1322191
2014-12-21 19:50:56 +01:00
Florian Kisser c6741fb537 [FIX] sql_db: don't log dsn with unmasked passwords
The dsn may contain the connection password of the database when not accessed from a psycopg connection object.
Replace the unfiltered logs to use cxn.dsn avoiding password leakage in logs.
Fixes #1433
2014-10-28 14:49:57 +01:00
David Monjoie 6e5b09acfa [FIX] removed bad comments from previous commit 2014-09-05 17:12:49 +02:00
David Monjoie f3333f9c57 [ADD] website_sale_digital 2014-09-05 17:11:12 +02:00
Christophe Simonis 415525cecc [FIX] allow `--log-db` to connect to another postgresql server than the one setted in config 2014-08-25 18:52:50 +02:00
Antony Lesuisse ed34640d3a [IMP] test display sql query counter 2014-07-01 21:57:55 +02:00
Xavier Morel 64ca79cc4c [IMP] remove usage of psycopg1.cursor, implement dictfetch* on openerp cursor 2014-06-20 07:54:44 +02:00
Christophe Simonis 3d2e9b4d2b [MERGE] forward port of branch 7.0 up to revid 5281 launchpad_translations_on_behalf_of_openerp-20140412094159-mhy3v2prb3ctx32k
bzr revid: jke@openerp.com-20140409153527-mic1a8afcvdhsd27
bzr revid: chs@openerp.com-20140410102422-fcwxhjk40z0oy8x5
bzr revid: chs@openerp.com-20140415133650-y46i0o3qkb2atbvi
2014-04-15 15:36:50 +02:00
Raphael Collet ea167ad7ab [IMP] test cursor: code cleanup to make it more robust to concurrent accesses
bzr revid: rco@openerp.com-20140414075906-2d0i4qhe4x7czsao
2014-04-14 09:59:06 +02:00
Raphael Collet d67e63150e [FIX] sql_db: forgotten attribute renaming _pool -> __pool
bzr revid: rco@openerp.com-20140410113950-71gcyz0t2rfuww57
2014-04-10 13:39:50 +02:00
Christophe Simonis 15680c94e1 [MERGE] forward port of branch saas-3 up to revid 5115 chs@openerp.com-20140410102422-fcwxhjk40z0oy8x5
bzr revid: chs@openerp.com-20140410105454-6utwgruj80h8wdss
2014-04-10 12:54:54 +02:00
Kersten Jeremy 3285feab53 [FIX] Allow missing opcodes, harden check for private attributes (dunder), check inside embedded code objects.
bzr revid: jke@openerp.com-20140409151659-xwttchbtbj02v1w7
2014-04-09 17:16:59 +02:00
Raphael Collet 5640f3076a [MERGE] test_cursor: implement a cursor mockup that never commits to database, and use it for http tests
bzr revid: rco@openerp.com-20140409145830-rop8esgic2y435kf
2014-04-09 16:58:30 +02:00
Raphael Collet dda229273d [IMP] sql_db: simplify TestCursor, given that method execute() does not need overriding
bzr revid: rco@openerp.com-20140409130825-rnc9hqh9t16hqcaq
2014-04-09 15:08:25 +02:00
Raphael Collet fd8fd0906f [IMP] make TestCursor more robust, and remove some tests on tools.config['test_enable']
bzr revid: rco@openerp.com-20140409103337-r0a1nx9h8nfg3cn3
2014-04-09 12:33:37 +02:00
Raphael Collet e5e00e4c0a [IMP] registry: now cursor() simply returns a cursor, which may itself be used as a context manager
bzr revid: rco@openerp.com-20140409095604-joh9dt0qkma12ykm
2014-04-09 11:56:04 +02:00
Raphael Collet f0fd48c44a [IMP] http tests: implement a test cursor that keeps a transaction open accross requests
- TestCursor subclasses Cursor, and simulates commit and rollback with savepoints
 - the registry manages a test mode, in which it only uses the test cursor
 - a reentrant lock forces the serialization of parallel requests

bzr revid: rco@openerp.com-20140408151736-j0guy68i2wjexy3d
2014-04-08 17:17:36 +02:00
Antony Lesuisse 09deba4826 [FIX] tests dont generate traceback on aborted test requests
bzr revid: al@openerp.com-20140317124343-kgesa5c215z19vpn
2014-03-17 13:43:43 +01:00
Xavier Morel bc86fdc614 [IMP] Cursor.savepoint
time.time doesn't guarantee sub-second precision.

Use a uuid1 instead (lower anonymity but higher isolation than uuid4
especially in distributed systems, and we don't care about anonimity for
savepoint names from application servers).

Quote name so first character can be a digit.

bzr revid: xmo@openerp.com-20140220103345-xistzxy17r8j87hf
2014-02-20 11:33:45 +01:00
Christophe Simonis d60cf404ca [FIX] orm._auto_init: fallback to copy method when altering in-place varchar columns failed.
When a varchar column has a dependence on a view, we cannot change the size in-place,
we need to manually re-create the column with the correct type.

bzr revid: chs@openerp.com-20140217182045-qor70r3gb0fch2ki
2014-02-17 19:20:45 +01:00
Antony Lesuisse 9248a2db18 [FIX] multiprocess mode, empty the cursor pool before forking
bzr revid: al@openerp.com-20140122221525-hify023pk5i8d0jm
2014-01-22 23:15:25 +01:00
Vo Minh Thu 307ca374d6 [MERGE] forward merge 7.0 until revision 4919.
bzr revid: vmt@openerp.com-20130404130704-24vsmczw34cssytd
2013-04-04 15:07:04 +02:00
Vo Minh Thu 1e7e2ca753 [REF] no longer use openerp.pooler.
Either use openerp.modules.registry.RegistryManager when the full
new() signature is needed, or use openerp.registry().

Replaced also some pool.get() with pool[] because KeyErrors
are better than AttributeErrors on None.

bzr revid: vmt@openerp.com-20130327111014-2i0hlvpy5y5ku7hm
2013-03-27 12:10:14 +01:00
Vo Minh Thu c99c4091ce [REM] Deleted .apidoc lines.
They were probably used by some tools. How sad.

bzr revid: vmt@openerp.com-20130212142410-zqdjd8jw3gtvxab0
2013-02-12 15:24:10 +01:00
Olivier Dony db81edc287 [FIX] *: fix/rationalize db logging to avoid incorrect values during logging
The setting/clearing of the tracking were not done
consistently, causing log messages that appeared
to come from one database while coming from another
one or none at all.

The tracker is now set at the earliest points
of request handling where we can:
- in web client, when creating WebRequests (dbname, uid)
- at RPC dispatching in server (uid)
- at cron job acquisition in CronWorker (dbname)
- at Registry acquisition in RegistryManager (dbname)


The tracker is cleared at the very entrance of
the request in the WSGI `application`, ensuring
that no logging is produced with an obsolete
db name. (It cannot be cleared at the end of
the request handling because the werkzeug
wrapper outputs more logging afterwards)

bzr revid: odo@openerp.com-20130301120744-jfitcmze2jldecod
2013-03-01 13:07:44 +01:00
Olivier Dony 0240416a13 [REVERT] sql_db: undo eager removal of connections from pool; could skip half the connections and is not strictly required
Credit to Florent Xicluna for spotting it!

lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: odo@openerp.com-20130219102610-ll69qaf3zxem1pxf
2013-02-19 11:26:10 +01:00
Olivier Dony bbb4f105dc [FIX] sql_db: immediately remove the connections from the pool when detected to be dead
lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: odo@openerp.com-20130216011831-5ehi02j5nj6shh8n
2013-02-16 02:18:31 +01:00
Olivier Dony 547372ef94 [FIX] sql_db: only perform the connection reset when actually planning to borrow that connection, not before, for obvious performance reasons
bzr revid: odo@openerp.com-20130215161025-mjgmlju3zgs50zk7
2013-02-15 17:10:25 +01:00
Olivier Dony 979c28d0c9 [FIX] sql_db: typo in previous patch for autodetection of closed connections
My bad, I did and undid this patch several times
in different manners and ended up commiting the
wrong one.

lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: odo@openerp.com-20130215151237-3ks21kfhjb2fvl2z
2013-02-15 16:12:37 +01:00
Olivier Dony e464e1231d [FIX] sql_db: closing a closed connection is not allowed in psycopg2 2.4.4 and earlier
Having the connections automatically reaped by
psycopg2 is not guaranteed to happen all the
time, so we still need to take extra steps
to forece-close them

bzr revid: odo@openerp.com-20130215113751-12kwmfynyt43qs57
2013-02-15 12:37:51 +01:00
Christophe Simonis 94715ccbec [FIX] sql_db: free dead database connections
lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: chs@openerp.com-20130214135227-x6lzy3gj0s75ssmw
2013-02-14 14:52:27 +01:00
Xavier Morel b6ece5d65f [REM] trailing semicolons
bzr revid: xmo@openerp.com-20121214124310-wfdkhmcwxnyqu30m
2012-12-14 13:43:10 +01:00
Xavier Morel 90a687ab7a [FIX] misplaced docstrings
bzr revid: xmo@openerp.com-20121214124243-kvg2cg00k0a4518p
2012-12-14 13:42:43 +01:00
Xavier Morel c6079dd6bb [REM] unnecessary parens
bzr revid: xmo@openerp.com-20121214123803-6xu2s1ndnoyj4i3e
2012-12-14 13:38:03 +01:00
Raphael Collet 11051f32e0 [FIX] res_users.login: fix query parameters in cr.execute
bzr revid: rco@openerp.com-20121015100148-pkanx35vr6fqojuj
2012-10-15 12:01:48 +02:00
Xavier Morel b4421c8fba [ADD] cache dict on the cursor, for request-local repeated reads
bzr revid: xmo@openerp.com-20120924101404-cel6oy1akabbo7id
2012-09-24 12:14:04 +02:00
Vo Minh Thu 23eb63f139 [MERGE] merged trunk.
bzr revid: vmt@openerp.com-20120206203151-3snkz7usngwtv1xt
2012-02-06 21:31:51 +01:00
Vo Minh Thu 1ab6f8883c [IMP] logging: _logger.warn() replaced by _logger.warning().
bzr revid: vmt@openerp.com-20120202092634-pylu3098p5c0mays
2012-02-02 10:26:34 +01:00
Vo Minh Thu 5341b5f445 [IMP] logging: _logger.log(DEBUG) replaced by _logger.debug().
bzr revid: vmt@openerp.com-20120202092105-mfufuv97h8zrc2n7
2012-02-02 10:21:05 +01:00
Antony Lesuisse 936ce97689 fix --log-sql
bzr revid: al@openerp.com-20120201002321-nstmlzxzrcfgev13
2012-02-01 01:23:21 +01:00
Ronald Portier 64773ba357 [FIX] drop database fails when done before connecting to server.
lp bug: https://launchpad.net/bugs/924783 fixed

bzr revid: ronald@therp.nl-20120201113759-wi2kogl2x1lsxk7g
2012-02-01 12:37:59 +01:00
Vo Minh Thu 283304f9a2 [IMP] warnings: turn warnings.warn into logging.warning:
Warnings are handled with the other logs (and not always sent to stderr),
they also appear under a module __name__ channel instead of py.warn.
The disadvantage is that there is no longer specific warnings,
such as pending deprecation warning or deprecation warning.

bzr revid: vmt@openerp.com-20120125132407-u33idc0qh7ecs1i5
2012-01-25 14:24:07 +01:00
Vo Minh Thu eadcdd1fd6 [IMP] openerp.wsgi: _logger with fully qualified module name.
bzr revid: vmt@openerp.com-20120124111438-730miqdcm3eljgds
2012-01-24 12:14:38 +01:00