diff options
author | Michael Elkins <melkins@tislabs.com> | 2011-04-07 04:11:16 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2011-04-07 04:11:16 +0000 |
commit | ecf3fef1d589f2f63a6a500172763d753188ec6d (patch) | |
tree | f3117b0ced530f9d9592dacd2bf5a23073be9958 /rpkid/rpki/gui/app/glue.py | |
parent | 9c59c55d2205457ad23044f526408cd21abba05b (diff) |
ADR vcard type is not a string, but a compound object
svn path=/rpkid/rpki/gui/app/glue.py; revision=3766
Diffstat (limited to 'rpkid/rpki/gui/app/glue.py')
-rw-r--r-- | rpkid/rpki/gui/app/glue.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rpkid/rpki/gui/app/glue.py b/rpkid/rpki/gui/app/glue.py index 7164e829..cc2ed607 100644 --- a/rpkid/rpki/gui/app/glue.py +++ b/rpkid/rpki/gui/app/glue.py @@ -104,12 +104,17 @@ def ghostbuster_to_vcard(gbr): vcard = vobject.vCard() vcard.add('N').value = vobject.vcard.Name(family=gbr.family_name, given=gbr.given_name) + + adr_fields = [ 'box', 'extended', 'street', 'city', 'region', 'code', 'country' ] + adr_dict = dict((f, getattr(gbr, f, '')) for f in adr_fields) + if any(adr_dict.itervalues()): + vcard.add('ADR').value = vobject.vcard.Address(**adr_dict) + # mapping from vCard type to Ghostbuster model field # the ORG type is a sequence of organization unit names, so # transform the org name into a tuple before stuffing into the # vCard object attrs = [ ('FN', 'full_name', None), - ('ADR', 'postal_address', None), ('TEL', 'telephone', None), ('ORG', 'organization', lambda x: (x,)), ('EMAIL', 'email_address', None) ] |