Merge lp:~therp-nl/banking-addons/7.0-abnamro-sepa_type_case into lp:banking-addons

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 197
Proposed branch: lp:~therp-nl/banking-addons/7.0-abnamro-sepa_type_case
Merge into: lp:banking-addons
Diff against target: 25 lines (+4/-4)
1 file modified
account_banking_nl_abnamro/abnamro.py (+4/-4)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/7.0-abnamro-sepa_type_case
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Stéphane Bidoul (Acsone) (community) code review, no test Approve
Review via email: mp+188782@code.launchpad.net

Description of the change

This proposal, upon approval, should preferably be merged with 6.1 too by means of cherrypicking

    bzr branch lp:banking-addons/6.1 ba61
    cd ba61
    bzr merge lp:~therp-nl/banking-addons/7.0-abnamro-sepa_type_case -r 189..190

To post a comment you must log in.
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

LGTM.

BTW, which one is better?

sepa_type = sepa_dict.get('TRTP') or ''
sepa_type = sepa_dict.get('TRTP', '')

-sbi

review: Approve (code review, no test)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for the review!

I would always go for the latter in cases like:

    bar = foo.get('bar')
    if bar:
        ...

But as I was going to run a string operation on the result, I didn't want to run the risk of sepa_dict containing a key 'TRTP' with value False (even if the preceding code currently seems to guarantee that when sepa_dict contains a key 'TRTP', the value will always be a string)

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Yes indeed, they are not equivalent. Getting tired :)

-sbi

On Wed, Oct 2, 2013 at 7:13 PM, Stefan Rijnhart (Therp) <email address hidden>wrote:

> Thanks for the review!
>
> I would always go for the latter in cases like:
>
> bar = foo.get('bar')
> if bar:
> ...
>
> But as I was going to run a string operation on the result, I didn't want
> to run the risk of sepa_dict containing a key 'TRTP' with value False (even
> if the preceding code currently seems to guarantee that when sepa_dict
> contains a key 'TRTP', the value will always be a string)
> --
>
> https://code.launchpad.net/~therp-nl/banking-addons/7.0-abnamro-sepa_type_case/+merge/188782
> You are reviewing the proposed merge of
> lp:~therp-nl/banking-addons/7.0-abnamro-sepa_type_case into
> lp:banking-addons.
>

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking_nl_abnamro/abnamro.py'
2--- account_banking_nl_abnamro/abnamro.py 2013-06-04 14:56:36 +0000
3+++ account_banking_nl_abnamro/abnamro.py 2013-10-02 09:00:52 +0000
4@@ -2,7 +2,7 @@
5 ##############################################################################
6 #
7 # Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>)
8-# 2011 Therp BV (<http://therp.nl>)
9+# 2011 - 2013 Therp BV (<http://therp.nl>)
10 #
11 # All Rights Reserved
12 #
13@@ -256,9 +256,9 @@
14
15 if self.transfer_type == 'SEPA':
16 sepa_dict = get_sepa_dict(''.join(fields))
17- sepa_type = sepa_dict.get('TRTP')
18- if sepa_type != 'SEPA OVERBOEKING':
19- raise ValueError,_('Sepa transaction type %s not handled yet')
20+ sepa_type = sepa_dict.get('TRTP') or ''
21+ if sepa_type.upper() != 'SEPA OVERBOEKING':
22+ raise ValueError, _('Sepa transaction type %s not handled yet') % sepa_type
23 self.remote_account = sepa_dict.get('IBAN',False)
24 self.remote_bank_bic = sepa_dict.get('BIC', False)
25 self.remote_owner = sepa_dict.get('NAME', False)

Subscribers

People subscribed via source and target branches

to status/vote changes: