Commit b83cdc53 authored by Nicolas Delaby's avatar Nicolas Delaby

If string is convert into list to guess structure address, convert list parts...

If string is convert into list to guess structure address, convert list parts into string before call setter aswell

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27042 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 60d07321
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
...@@ -32,8 +33,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface ...@@ -32,8 +33,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5.Document.Coordinate import Coordinate from Products.ERP5.Document.Coordinate import Coordinate
from os import linesep
import string
class GeographicAddress(Coordinate, Base): class GeographicAddress(Coordinate, Base):
""" """
...@@ -86,21 +86,22 @@ class GeographicAddress(Coordinate, Base): ...@@ -86,21 +86,22 @@ class GeographicAddress(Coordinate, Base):
Tries to recognize the coordinate_text to update Tries to recognize the coordinate_text to update
this address this address
""" """
lines = string.split(coordinate_text, '\n')
lines = coordinate_text.split(linesep)
self.setStreetAddress('') self.setStreetAddress('')
self.setZipCode('') self.setZipCode('')
self.setCity('') self.setCity('')
zip_city = None zip_city = None
if len(lines ) > 1: if len(lines) > 1:
self.setStreetAddress(lines[0:-1]) self.setStreetAddress(linesep.join(lines[0:-1]))
zip_city = string.split(lines[-1]) zip_city = lines[-1].split()
elif len(lines ) > 0: elif lines:
self.setStreetAddress('') self.setStreetAddress('')
zip_city = string.split(lines[-1]) zip_city = lines[-1].split()
if zip_city: if zip_city:
self.setZipCode(zip_city[0]) self.setZipCode(zip_city[0])
if len(zip_city) > 1: if len(zip_city) > 1:
self.setCity(string.join(zip_city[1:])) self.setCity(linesep.join(zip_city[1:]))
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'standardTextFormat') 'standardTextFormat')
......
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