Merge lp://staging/~savoirfairelinux-openerp/openerp-hr/department_sequence_concatination_NoneType into lp://staging/openerp-hr

Status: Merged
Merged at revision: 79
Proposed branch: lp://staging/~savoirfairelinux-openerp/openerp-hr/department_sequence_concatination_NoneType
Merge into: lp://staging/openerp-hr
Diff against target: 114 lines (+93/-0)
3 files modified
hr_department_sequence/hr_department.py (+2/-0)
hr_department_sequence/tests/__init__.py (+29/-0)
hr_department_sequence/tests/test_hr_department.py (+62/-0)
To merge this branch: bzr merge lp://staging/~savoirfairelinux-openerp/openerp-hr/department_sequence_concatination_NoneType
Reviewer Review Type Date Requested Status
Katja Matthes (community) code review Approve
Guewen Baconnier @ Camptocamp Approve
Daniel Reis Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+212436@code.staging.launchpad.net

Description of the change

Fix a name_search bug and add a test to prevent future regressions:

openerp.addons.hr_department_sequence.hr_department in name_search
TypeError: can only concatenate list (not "NoneType") to list

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM. You can also make one liner with:

..., name)] + args or [],

Regards.

review: Approve (code review)
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Thank you for the review.

I could make it a one liner, but I think it's easier to read this way.
The line is long enough as it is :)

Revision history for this message
Daniel Reis (dreis-pt) wrote :

How about this?
   args = args or []

review: Approve
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Just trying to have constant style with

if context is None:
    context = context

Could also use args = args or list(), args = [] in the signature.

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

 if context is None:
- context = context
+ context = {}

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> How about this?
> args = args or []

With this one, you will build a new list when args is an empty list, which is unnecessary.

review: Approve
Revision history for this message
Katja Matthes (katja-matthes) wrote :

Hello,

looks good. Tests run fine.
I think, since you made a fix you should update the module's version number.

Regards.

review: Approve (code review)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

>> How about this?
>> args = args or []
>
> With this one, you will build a new list when args is an empty list, which is unnecessary.

Indeed, but personally I appreciate it's brevity, compared with a 2-line 'if' statement.

Just occurred to me this one line alternative, but it's still not as neat:
args = [] if args is None else args

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.