Commit bb517430 authored by Romain Courteaud's avatar Romain Courteaud

Use Accessors instead of setting attributes directly.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9382 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 502f2f9b
...@@ -73,11 +73,11 @@ class GeographicAddress(Coordinate, Base): ...@@ -73,11 +73,11 @@ class GeographicAddress(Coordinate, Base):
with street address, zip, city and region with street address, zip, city and region
""" """
if country=='France' or country=='france' or country=='fr' : if country=='France' or country=='france' or country=='fr' :
return ('%s\n%s %s') % (self.street_address or '', return ('%s\n%s %s') % (self.getStreetAddress() or '',
self.zip_code or '', self.city or '') self.getZipCode() or '', self.getCity() or '')
else : else :
return ('%s\n%s %s') % (self.street_address or '', return ('%s\n%s %s') % (self.getStreetAddress() or '',
self.city or '', self.zip_code or '') self.getCity() or '', self.getZipCode() or '')
security.declareProtected(Permissions.ModifyPortalContent, 'fromText') security.declareProtected(Permissions.ModifyPortalContent, 'fromText')
def fromText(self, coordinate_text): def fromText(self, coordinate_text):
...@@ -86,21 +86,21 @@ class GeographicAddress(Coordinate, Base): ...@@ -86,21 +86,21 @@ class GeographicAddress(Coordinate, Base):
this address this address
""" """
lines = string.split(coordinate_text, '\n') lines = string.split(coordinate_text, '\n')
self.street_address = '' self.setStreetAddress('')
self.zip_code = '' self.setZipCode('')
self.city = '' self.setCity('')
zip_city = None zip_city = None
if len(lines ) > 1: if len(lines ) > 1:
self.street_address = lines[0:-1] self.setStreetAddress(lines[0:-1])
zip_city = string.split(lines[-1]) zip_city = string.split(lines[-1])
elif len(lines ) > 0: elif len(lines ) > 0:
self.street_address = '' self.setStreetAddress('')
zip_city = string.split(lines[-1]) zip_city = string.split(lines[-1])
if zip_city: if zip_city:
self.zip_code = zip_city[0] self.setZipCode(zip_city[0])
if len(zip_city) > 1: if len(zip_city) > 1:
self.city = string.join(zip_city[1:]) self.setCity(string.join(zip_city[1:]))
self.reindexObject() # self.reindexObject()
security.declareProtected(Permissions.View, 'standardTextFormat') security.declareProtected(Permissions.View, 'standardTextFormat')
def standardTextFormat(self): def standardTextFormat(self):
......
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