View | Details | Raw Unified | Return to bug 238543 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	pycarddav
3
PORTNAME=	pycarddav
4
PORTVERSION=	0.7.0
4
PORTVERSION=	0.7.0
5
PORTREVISION=	1
5
PORTREVISION=	2
6
CATEGORIES=	www python
6
CATEGORIES=	www python
7
MASTER_SITES=	CHEESESHOP
7
MASTER_SITES=	CHEESESHOP
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
(-)files/patch-pycarddav_model.py (+46 lines)
Line 0 Link Here
1
--- pycarddav/model.py.orig	2014-02-04 23:38:46 UTC
2
+++ pycarddav/model.py
3
@@ -27,6 +27,7 @@ The pycarddav abstract model and tools for VCard handl
4
 from __future__ import print_function
5
 
6
 import base64
7
+import chardet
8
 import logging
9
 import sys
10
 from collections import defaultdict
11
@@ -197,8 +198,17 @@ class VCard(defaultdict):
12
 
13
     @property
14
     def name(self):
15
-        return unicode(self['N'][0][0]) if self['N'] else ''
16
+        #return unicode(self['N'][0][0]) if self['N'] else ''
17
+        if self['N']:
18
+            if type(self['N'][0][0]) is unicode:
19
+                return self['N'][0][0]
20
+            else:
21
+                return unicode(self['N'][0][0], chardet.detect(self['N'][0][0])['encoding'])
22
+        else:
23
+            return ''
24
 
25
+        #return unicode(self['N'][0][0], chardet.detect(self['N'][0][0])['encoding']) if self['N'] else ''
26
+
27
     @name.setter
28
     def name(self, value):
29
         if not self['N']:
30
@@ -207,7 +217,14 @@ class VCard(defaultdict):
31
 
32
     @property
33
     def fname(self):
34
-        return unicode(self['FN'][0][0]) if self['FN'] else ''
35
+        #return unicode(self['FN'][0][0]) if self['FN'] else ''
36
+        if self['FN']:
37
+            if type(self['FN'][0][0]) is unicode:
38
+                return self['FN'][0][0]
39
+            else:
40
+                return unicode(self['FN'][0][0], chardet.detect(self['FN'][0][0])['encoding'])
41
+        else:
42
+            return ''
43
 
44
     @fname.setter
45
     def fname(self, value):
46

Return to bug 238543