Commit 65fe1bb1 authored by Kevin Deldycke's avatar Kevin Deldycke

Some properties must never return None.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4185 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 925ecf52
...@@ -70,6 +70,46 @@ class BankAccount(Folder, Coordinate): ...@@ -70,6 +70,46 @@ class BankAccount(Folder, Coordinate):
__implements__ = ( Interface.Coordinate ) __implements__ = ( Interface.Coordinate )
security.declareProtected(Permissions.View, 'getBankCode')
def getBankCode(self, **kw):
"""
Never return None.
"""
if self.bank_code == None:
return ''
return self.bank_code
security.declareProtected(Permissions.View, 'getBranch')
def getBranch(self, **kw):
"""
Never return None.
"""
if self.branch == None:
return ''
return self.branch
security.declareProtected(Permissions.View, 'getBankAccountNumber')
def getBankAccountNumber(self, **kw):
"""
Never return None.
"""
if self.bank_account_number == None:
return ''
return self.bank_account_number
security.declareProtected(Permissions.View, 'getBankCountryCode')
def getBankCountryCode(self, **kw):
"""
Never return None.
"""
if self.bank_country_code == None:
return ''
return self.bank_country_code
security.declareProtected(Permissions.View, 'getIbanTextFormat') security.declareProtected(Permissions.View, 'getIbanTextFormat')
def getIbanTextFormat(self): def getIbanTextFormat(self):
""" """
...@@ -92,9 +132,6 @@ class BankAccount(Folder, Coordinate): ...@@ -92,9 +132,6 @@ class BankAccount(Folder, Coordinate):
key = self.getIbanKey() key = self.getIbanKey()
country_code = self.getBankCountryCode() country_code = self.getBankCountryCode()
bban = self.getBban() bban = self.getBban()
if key == None: key = ''
if country_code == None: country_code = ''
if bban == None: bban = ''
return (country_code + key + bban).upper().strip() return (country_code + key + bban).upper().strip()
...@@ -131,10 +168,6 @@ class BankAccount(Folder, Coordinate): ...@@ -131,10 +168,6 @@ class BankAccount(Folder, Coordinate):
branch = self.getBranch() branch = self.getBranch()
ban = self.getBankAccountNumber() ban = self.getBankAccountNumber()
key = self.getBbanKey() key = self.getBbanKey()
if bank == None: bank = ''
if branch == None: branch = ''
if ban == None: ban = ''
if key == None: key = ''
return (bank + branch + ban + key).upper().strip() return (bank + branch + ban + key).upper().strip()
...@@ -147,10 +180,6 @@ class BankAccount(Folder, Coordinate): ...@@ -147,10 +180,6 @@ class BankAccount(Folder, Coordinate):
branch = self.getBranch() branch = self.getBranch()
ban = self.getBankAccountNumber() ban = self.getBankAccountNumber()
key = self.getBbanKey() key = self.getBbanKey()
if bank == None: bank = ''
if branch == None: branch = ''
if ban == None: ban = ''
if key == None: key = ''
return sep.join([bank, branch, ban, key]).upper().strip() return sep.join([bank, branch, ban, key]).upper().strip()
...@@ -170,9 +199,6 @@ class BankAccount(Folder, Coordinate): ...@@ -170,9 +199,6 @@ class BankAccount(Folder, Coordinate):
bank = self.getBankCode() bank = self.getBankCode()
branch = self.getBranch() branch = self.getBranch()
ban = self.getBankAccountNumber() ban = self.getBankAccountNumber()
if bank == None: bank = ''
if branch == None: branch = ''
if ban == None: ban = ''
if len(bank + branch + ban) == 0: if len(bank + branch + ban) == 0:
return '' return ''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment