- commit
- d9814f9eda06537d07c47911d61659e7e705712f
- parent
- 5d0445dde222f2b238c2fc5bb9984a67cfb1cfb9
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-05-08 08:27
rm vcard support
Diffstat
| M | cctool.py | 44 | -------------------------------------------- |
| M | setup.py | 1 | - |
| M | tests.py | 13 | ------------- |
3 files changed, 0 insertions, 58 deletions
diff --git a/cctool.py b/cctool.py
@@ -72,8 +72,6 @@ def formats(): 72 72 if not isinstance(vobject, Exception): 73 73 informats['ics'] = ICal 74 74 outformats['ics'] = ICal75 -1 informats['vcf'] = VCard76 -1 outformats['vcf'] = VCard77 75 if not isinstance(ldif, Exception): 78 76 informats['ldif'] = LDIF 79 77 return informats, outformats @@ -305,48 +303,6 @@ class LDIF(Format): 305 303 raise NotImplementedError 306 304 307 305308 -1 class VCard(Format):309 -1 fields = ['fn', 'n', 'nickname', 'photo', 'bday', 'anniversary', 'gender',310 -1 'adr', 'tel', 'email', 'impp', 'lang', 'tz', 'geo', 'title', 'role',311 -1 'logo', 'org', 'member', 'related', 'categories', 'note', 'prodid', 'rev',312 -1 'sound', 'uid', 'clientpidmap', 'url', 'version', 'key', 'fburl',313 -1 'caladruri', 'caluri']314 -1315 -1 @classmethod316 -1 def load(cls, fh):317 -1 if isinstance(vobject, Exception):318 -1 raise vobject319 -1320 -1 for vcard in vobject.readComponents(fh):321 -1 d = MultiDict()322 -1 for key, value in vcard.contents.iteritems():323 -1 d[key] = [i.value for i in value]324 -1 yield d325 -1326 -1 @classmethod327 -1 def _dump_field(cls, key, item, vcard):328 -1 if key == 'name':329 -1 vcard.add('fn').value = item.join(key)330 -1 elif key == 'nick':331 -1 for value in item[key]:332 -1 vcard.add('nickname').value = value333 -1 elif key in cls.fields:334 -1 for value in item[key]:335 -1 vcard.add(key).value = value336 -1337 -1 @classmethod338 -1 def dump(cls, data, fh):339 -1 if isinstance(vobject, Exception):340 -1 raise vobject341 -1342 -1 for item in data:343 -1 vcard = vobject.vCard()344 -1 vcard.add('n').value = ''345 -1 for key in item:346 -1 cls._dump_field(key, item, vcard)347 -1 vcard.serialize(fh)348 -1349 -1350 306 class DateTimeJSONEncoder(json.JSONEncoder): 351 307 def default(self, obj): 352 308 if isinstance(obj, datetime):
diff --git a/setup.py b/setup.py
@@ -13,7 +13,6 @@ setup( 13 13 extras_require={ 14 14 'ldif': ['python-ldap'], 15 15 'ical': ['vobject'],16 -1 'vcard': ['vobject'],17 16 }, 18 17 license='GPLv3+', 19 18 entry_points={'console_scripts': 'cctool=cctool:main'},
diff --git a/tests.py b/tests.py
@@ -119,19 +119,6 @@ class TestLDIF(_TestFormat): 119 119 pass 120 120 121 121122 -1 @unittest.skipIf(isinstance(cctool.vobject, Exception), 'vobject not available')123 -1 class TestVCard(_TestFormat):124 -1 def setUp(self):125 -1 self.format = cctool.VCard()126 -1 self.data = [cctool.MultiDict({127 -1 u'version': [u'4.0'],128 -1 u'fn': [u'Forrest Gump'],129 -1 u'email': [u'forrestgump@example.com'],130 -1 u'rev': [u'20080424T195243Z'],131 -1 })]132 -1 self.text = 'BEGIN:VCARD\nVERSION:4.0\nFN:Forrest Gump\nEMAIL:forrestgump@example.com\nREV:20080424T195243Z\nEND:VCARD'133 -1134 -1135 122 class TestJSON(_TestFormat): 136 123 def setUp(self): 137 124 self.format = cctool.JSON()