Changeset 2320

Show
Ignore:
Timestamp:
07/12/07 12:31:06 (1 year ago)
Author:
abaumann
Message:

hack around some problems with address mappings:

  • addresses without a location are assumed to be Home addresses
  • don't uppercase the location when generating XML
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/moto-sync/motosync.py

    r2318 r2320  
    18501850 
    18511851        # process addresses, create a hash from contacttype to address 
    1852         # FIXME: addresses that don't map to moto contact types are dropped 
     1852        # addresses that don't map to moto contact types are dropped 
    18531853        addresses = {} 
    18541854        for adr in doc.getElementsByTagName('Address'): 
    18551855            address = [getXMLField(adr, p) for p in XML_ADDRESS_PARTS] 
    18561856            ical_types = adr.getAttribute('Location').split(';') 
     1857            # XXX: HACK: if it has no type, assume it's a home address 
     1858            if ical_types == [] or ical_types == ['']: 
     1859                ical_types = ['Home'] 
    18571860            for t in ical_types: 
    18581861                t = t.lower() 
     
    18631866 
    18641867        # create a child for each telephone/address pair or email 
     1868        # addresses for which there is no phone number are dropped 
    18651869        for (moto_type, contact, is_pref) in contacts: 
    18661870            if moto_type == MOTO_CONTACT_EMAIL: 
     
    19571961            if e.hasChildNodes(): 
    19581962                if MOTO_ADDRESS_TYPES.has_key(self.contacttype): 
    1959                     e.setAttribute('Location', MOTO_ADDRESS_TYPES[self.contacttype].upper()
     1963                    e.setAttribute('Location', MOTO_ADDRESS_TYPES[self.contacttype]
    19601964                ret.append(e) 
    19611965