|
|
mads
|
5e46f73f0d1c
|
5 years ago
|
|
|
|
|
mads
|
b095e2fbba44
|
5 years ago
|
|
|
|
|
mads
|
e63bcce18fef
|
6 years ago
|
|
|
|
|
mads
|
c146a2ab50a8
|
6 years ago
|
|
tests: accept py3 output in test_list_valued_setting_update
The old behaviour seems completely broken and useless and thus evidently unused ... but the new result seems slightly better.
|
|
|
mads
|
0a277465fddf
|
7 years ago
|
|
|
|
|
Lars Kruse
|
7691290837d2
|
9 years ago
|
|
codingstyle: trivial whitespace fixes
Reported by flake8.
|
|
|
Søren Løvborg
|
bf3546d1cd77
|
9 years ago
|
|
db: clean up SQLAlchemy session flushes
Many calls to Session().flush() were completely superfluous and have been removed. (See also the note on "flush" in the contributor docs.) For the remaining calls, a comment has been added to explain why it's necessary.
|
|
|
Søren Løvborg
|
4136526cce20
|
9 years ago
|
|
db: remove superfluous Session.add calls
Don't re-add objects to the SQLAlchemy Session just because they were modified. Session.add is only for freshly constructed objects that SQLAlchemy doesn't know about yet.
The rules are quite simple:
When creating a database object by calling the constructor directly, it must explicitly be added to the session.
When creating an object using a factory function (like "create_repo"), the returned object has already (by convention) been added to the session, and should not be added again.
When getting an object from the session (via Session.query or any of the utility functions that look up objects in the database), it's already added, and should not be added again. SQLAlchemy notices attribute modifications automatically for all objects it knows about.
|
|
|
Søren Løvborg
|
555c8d26988f
|
9 years ago
|
|
db: always add to session in Setting.create_or_update
There's no use case for not adding the newly created Setting to the SQLAlchemy session (and thus, once we commit, the database).
With this change, all the various "create" model methods add their result to the session.
|
|
|
Konstantin Veretennicov
|
83c34fbb2139
|
10 years ago
|
|
|