Commit Graph
4928 Commits
Author SHA1 Message Date
Cédric Krier c19f93cd9b NotLogged exception is no more used
issue5415
review17971003
2016-03-21 23:39:30 +01:00
Cédric Krier 33b240736c Re-introduce iteration over keys
It was removed in changeset 808e05f4898c but indeed we need a copy list of the
keys because the dictionary is modified during the iteration.
2016-03-19 15:25:49 +01:00
Cédric Krier 23c45fc511 Group records when calling set method for field with the same value
We need to loop to compare the values instead of using a dictionary because the
values are not necessary hashable. But it is still an improvement compared to
calling the set method for each record.

issue5398
review19111002
2016-03-19 12:07:27 +01:00
Cédric Krier 1380d60c45 Cache default values in ModelSQL.create
default values should be constant during the create transaction so we could
cache the result and avoid query it for each created record.

issue5397
review16121002
2016-03-19 12:04:35 +01:00
Cédric Krier 510931a8ab Use OrderedDict in Workflow.transition for cache alignment
This allows to loop over the key in the same order as the list of records.
Also avoid to use .keys() when iterating on dict because it generate a useless
list on Python2.
Use list on dict instead of .keys() to avoid one extra call on Python3 because
.key() return an iterator.

issue5396
review20061002
2016-03-19 11:59:52 +01:00
Cédric Krier a650e8469f Speed up pool setup
We split the operations into two steps, so we can do the setup calls at the end
if there is no installation or update.

issue5302
review17041002
2016-03-17 22:56:58 +01:00
Cédric Krier 39bcde5357 Use a separate cursor in loop to set translation
cursor_dict returns an iterator that consumes the cursor. This means the cursor
can not be used before the iteration is stopped. So we need to use another
cursor to make the update queries.
2016-03-17 17:14:53 +01:00
Cédric Krier 1e0d860fe3 Use simple connection to list databases
When we instantiate a Database for each database to test, the threaded
connection pool keep one connection opens which could consume all the available
connections even if the databases are not really used.

issue5368
review16091002
2016-03-16 22:12:22 +01:00
Cédric Krier 3d8abb5059 Use SQL query to remove old login attempt
This is more efficient if there are a huge number of old login attempt because
it avoid to fetch the ids and to have loop over them to delete.

issue5377
review24901002
2016-03-16 22:10:37 +01:00
Cédric Krier 6a60572576 Transaction needs to be committed before reseting the Cache
Cache.resets create a new transaction but SQLite keeps a lock from the previous
transaction is it was not committed.
This commit was removed by changeset 9b2e0aac2d9c

issue5388
review16071002
2016-03-16 22:07:46 +01:00
Cédric Krier 1a4687d905 Add test for Sequence number next
issue5329
review17931002
2016-03-16 22:04:18 +01:00
Cédric Krier 6b2f90e0f5 Sequence number next has no value for type different of incremental
issue5329
review17931002
2016-03-16 22:03:41 +01:00
Sergi Almacellas Abellana 4b7c47b3bd Add missing separator start the server first step
issue5411
review17961002
2016-03-16 15:07:25 +01:00
Cédric Krier 4a4a62dbe1 Add missing Database.connect in list with sqlite
The test method requires the database instance to be connected.

issue5407
review24941002
2016-03-16 13:06:37 +01:00
Sergi Almacellas Abellana 4282f9e48f Use cursor from connection instead of transaction on notes
Since changeset 9b2e0aac2d9c
issue5405
review20081002
2016-03-16 13:02:31 +01:00
Cédric Krier 9dfb717088 Always use __name__ instead of _get_name to raise access_error
Other similar exception use __name__
2016-03-16 12:48:15 +01:00
Cédric Krier bfe9e5bea8 ModelStorage._clean_defaults must skip related fields
Related fields like '.rec_name' could be set as default value, they are not
defined in _fields and they must be cleaned.

issue5376
review17131002
2016-03-16 12:46:20 +01:00
Cédric Krier 9b94696b05 Speed up instantiation of Models
Pass as much possible, pre-computed parameters to __init__ to move their
computation outside the loop.

issue5294
review20721002
2016-03-15 19:01:47 +01:00
Cédric Krier 33d8f038d7 Add workflow graph on ir.model
issue5292
review15961002
2016-03-15 18:59:11 +01:00
Cédric Krier ad60794d73 Add context model on ir.action.act_window
issue5220
review20621002
2016-03-15 17:45:07 +01:00
Cédric Krier 8a4ba59b2d Switch to WSGI API
issue4646
review20541003
2016-03-15 16:57:26 +01:00
Cédric Krier 687a51a30c Limit the login size in LoginAttempt
The login data comes from an unauthenticated user so it could be very large and
thus fill the database. But indeed we don't need to have the full login to get
the LoginAttempt benefit, just the 1024 starting char is enough.

issue5381
review17901002
2016-03-14 19:33:40 +01:00
Jean Cavallo e6073b7fb8 Properly handle skip_data
First entries of "skip_data" blocks were always imported,
since the call to startElement was done right after setting
the taghandler attribute.

issue5254
review20781003
2016-03-13 21:46:30 +01:00
Cédric Krier 4b88535451 Update tox.ini for the new required version of psycopg2
issue5391
review16071003
2016-03-13 16:16:53 +01:00
Cédric Krier e19696779b Backed out changeset 83e1c6b2741e
Ubuntu python3-lxml doesn't have a working etree module for all Python version.

issue5389
2016-03-12 16:39:09 +01:00
Cédric Krier fa2da27621 Use sitepackages option to run tox on drone
issue5389
2016-03-12 16:17:25 +01:00
Cédric Krier d7815c5697 Remove useless include of trytond/ir/module/*.xml
The module directory of ir have been removed in changeset 98bcb2ee56c2
2016-03-12 15:28:52 +01:00
Cédric Krier e3e93ea748 Update required version of psycopg2
With issue4949, we need context management on connection and cursor,
this was introduced in psycopg2 version 2.5.

review24911002
2016-03-10 22:27:21 +01:00
Cédric Krier 5c291d56a4 Sync python-sql dependency version from the doc with setup.py 2016-03-10 14:26:53 +01:00
Cédric Krier bf6f7c7746 Database.init doesn't take cursor anymore 2016-03-06 02:04:13 +01:00
Cédric Krier 49a844013e Missing PEP-0249 for db_exist 2016-03-05 18:33:24 +01:00
Cédric Krier 9dba6822a9 Missing close when Transaction put connection
If the Transaction is started with close, it should force to close the
connection when put back.
2016-03-05 18:32:49 +01:00
Cédric Krier a94627b160 Remove LocalDict from tools
issue5364
review21781002
2016-03-05 17:31:25 +01:00
Cédric Krier 4d58b3a720 Don't remove from context the format of Binary fields
The getter of the Binary field could be called many times in the same
transaction, so popping out the format from the context create a side effect
that changes the requested format.

issue3774
review19981002
2016-03-05 17:26:27 +01:00
Cédric Krier 22dc3d23bc Remove __setattr__ from Model
This method is there to only skip the id attribute to be set using the field
__set__ but it has a cost as it is called each time an attribute is set.
So we store now the id value in the attribute '_id' which doesn't overload the
field and we adapt field __get__ for this new location.
The __getitem__ is also removed as it is deprecated since 2.6.

issue5296
review17031002
2016-03-04 00:19:18 +01:00
Cédric Krier 512808e151 Add LRUDictTransaction
issue5293
review22771002
2016-03-03 23:27:38 +01:00
Nicolas Évrard 2fef479575 Follow PEP-0249 for Transaction and backends
issue4949
review19781002
2016-03-03 21:51:57 +01:00
Cédric Krier 3e13f3d004 Fix SQLite greatest and least for unorderable None
In Python3, None can not be ordered because it doesn't have a natural order.
So we implement the same behaviour for SQLite than PostgreSQL which ignore NULL.

issue5358
review20821002
2016-03-01 21:46:14 +01:00
Nicolas Évrard 356fd6e9e7 Open view and icon files in binary mode
Since the support of python3 has been added file_open will return unicode
object when read in normal mode but icon files has to be considered as bytes
and lxml.etree.fromstring expect also bytes when there is an encoding
declaration (and not unicode).

issue5354
review17081002
2016-02-29 13:03:57 +01:00
Cédric Krier 64d6e4b3ec Test values against bytes instead of str
For Python3 compatibility, the test to decode should be done on bytes because
str in Python3 is already a unicode.

issue5355
review24851004
2016-02-27 23:48:28 +01:00
Cédric Krier ae8975ede3 Add doctest checker for Python 2-3
2to3 doesn't convert unicode string of Python 2 into string of Python 3.
So we will use a special checker that remove the 'u' prefix when checking
output.

issue3211
review19911002
2016-02-24 22:00:06 +01:00
Nicolas Évrard 61018dc9b7 Fix wrong test for existing database introduced in changeset 903a52fc1bb2
issue5238
review18861002
2016-02-23 17:40:30 +01:00
Cédric Krier 91b09d297d Cache must be cleared on each Cron.run
issue5332
review21711002
2016-02-22 23:17:19 +01:00
Nicolas Évrard 9aa648513e re-add the use of the case removed in changeset 0c62b08fa917
Removing the case resulted in the evaluation of expression that were not valid
like the cast of a string into an integer.

issue5335
review16011002
2016-02-19 12:43:12 +01:00
Cédric Krier 68eca37c72 Add _update_definitions after column_rename
issue5325
review16001002
2016-02-15 10:07:18 +01:00
Cédric Krier af00126074 Allow to modify XML record with noupdate
issue5176
review19851002
2016-02-11 22:18:29 +01:00
Cédric Krier 70827fe06b XML files must be open in binary mode for sax parser
The sax parser expect a byte stream, so we must open the file with the binary
mode. Also file_open should have a default encoding to None because encoding
should not be set in binary mode.

issue5313
2016-02-09 22:45:44 +01:00
Cédric Krier 7ca5529e49 Use assertValid instead of assert_from lxml.etree.RelaxNG
2to3 convert assert_ into assertTrue but this method is not defined in lxml.
To avoid this conversion, we use assertValid.

issue5314
review21681002
2016-02-09 21:05:37 +01:00
Cédric Krier 8eeb0140ed Add encoding to file_open
For Python3, we must define the encoding when opening a file.

issue5313
review21671002
2016-02-09 21:04:39 +01:00
Cédric Krier 41f4702273 Use warnings instead of logging for missing SQLite TableHandler features
and capture warnings into logging.
This allow to not be flooded by the same kind of warnings when running tests.

issue5316
review17821002
2016-02-09 18:42:59 +01:00