hr_timesheet_reminder: {}.fromkeys with a mutable argument in second position
Bug #1089390 reported by
Guewen Baconnier @ Camptocamp
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Camptocamp Addons |
Confirmed
|
Undecided
|
Unassigned | ||
HR - Timesheet Management |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
hr_timesheet_
def get_reminder_
"""Return the list of users that must receive the email"""
res = {}.fromkeys(ids, [])
Never use a mutable second argument in fromkeys!
The keys are linked with the same list instance.
Related branches
lp:~camptocamp/hr-timesheet/6.1-hr_timesheet_reminder-fix-lp1089390
- Alexandre Fayolle - camptocamp: Approve (code review, no test)
-
Diff: 28 lines (+8/-8)1 file modifiedhr_timesheet_reminder/company.py (+8/-8)
lp:~camptocamp/c2c-addons/6.0-hr_timesheet_reminder-fix-lp1089390
Ready for review
for merging
into
lp:c2c-addons/6.0
- Alexandre Fayolle - camptocamp: Approve (code review, no test)
-
Diff: 27 lines (+7/-8)1 file modifiedhr_timesheet_reminder/company.py (+7/-8)
lp:~camptocamp/hr-timesheet/7.0-hr_timesheet_reminder-migr
- Alexandre Fayolle - camptocamp: Approve (code review, no test)
-
Diff: 1734 lines (+626/-669)14 files modifiedhr_timesheet_reminder/__init__.py (+15/-26)
hr_timesheet_reminder/__openerp__.py (+41/-43)
hr_timesheet_reminder/company.py (+50/-57)
hr_timesheet_reminder/hr_employee.py (+42/-53)
hr_timesheet_reminder/hr_employee_view.xml (+0/-1)
hr_timesheet_reminder/reminder.py (+100/-88)
hr_timesheet_reminder/report/__init__.py (+16/-25)
hr_timesheet_reminder/report/timesheet_status.py (+63/-65)
hr_timesheet_reminder/report/timesheet_status.rml (+157/-163)
hr_timesheet_reminder/timesheet_report.xml (+10/-10)
hr_timesheet_reminder/wizard/reminder_config.py (+37/-45)
hr_timesheet_reminder/wizard/reminder_config_view.xml (+38/-28)
hr_timesheet_reminder/wizard/reminder_status.py (+35/-44)
hr_timesheet_reminder/wizard/reminder_status_view.xml (+22/-21)
description: | updated |
summary: |
- {}.fromkeys with a mutable argument in second position + hr_timesheet_reminder: {}.fromkeys with a mutable argument in second + position |
Changed in hr-timesheet: | |
status: | New → Confirmed |
status: | Confirmed → Fix Released |
Changed in c2c-addons: | |
status: | New → Confirmed |
To post a comment you must log in.
the fix is to write:
def get_reminder_ recipients( self, cr, uid, ids, context=None):
res[ id] = []
"""Return the list of users that must receive the email"""
res = {}
for id in ids:
or given a sufficiently recent python version:
res = {id: [] for id in ids}