Issue 11714

Title
Wrong usage of lstrip to remove field name prefix
Priority
feature
Status
resolved
Nosy list
ced, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2022-09-19.15:58:32 by ced, last changed 1 month ago by roundup-bot.

Messages

New changeset 2a082b26808f by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/tryton-env/rev/2a082b26808f
New changeset 82c2a49236c6 by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/stock_lot/rev/82c2a49236c6
New changeset 1157b8d4aa69 by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/stock/rev/1157b8d4aa69
New changeset 696862f0e72f by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/sale/rev/696862f0e72f
New changeset 3c8974df1eef by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/purchase/rev/3c8974df1eef
New changeset 0ff7d5831b7a by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/product_kit/rev/0ff7d5831b7a
New changeset 3c2c6d74f4b1 by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/marketing_automation/rev/3c2c6d74f4b1
New changeset 5455ab722879 by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/account_payment/rev/5455ab722879
New changeset 622edeaf2012 by Cédric Krier in branch 'default':
Use length of field name instead of lstrip to get nested part of clause
https://hg.tryton.org/modules/account/rev/622edeaf2012
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-09-19.15:58:31

In many modules, we use in searcher method: nested = clause[0].lstrip(name)
This gives the right result but it is not error prone because we could have letters arranged in different order.
So I think it is better to use this pattern: nested = clause[0][len(name):]

History
Date User Action Args
2022-10-01 15:36:34roundup-botsetmessages: + msg78500
2022-10-01 15:36:29roundup-botsetmessages: + msg78499
2022-10-01 15:36:26roundup-botsetmessages: + msg78498
2022-10-01 15:36:22roundup-botsetmessages: + msg78497
2022-10-01 15:36:10roundup-botsetmessages: + msg78496
2022-10-01 15:36:07roundup-botsetmessages: + msg78495
2022-10-01 15:36:04roundup-botsetmessages: + msg78494
2022-10-01 15:36:00roundup-botsetmessages: + msg78493
2022-10-01 15:35:56roundup-botsetmessages: + msg78492
nosy: + roundup-bot
status: testing -> resolved
2022-10-01 15:34:28reviewbotsetmessages: + msg78491
2022-09-19 16:41:48reviewbotsetmessages: + msg78223
nosy: + reviewbot
2022-09-19 16:25:49cedsetkeyword: + review
reviews: 437381003
status: in-progress -> testing
2022-09-19 15:58:32cedcreate