Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'str' object has no attribute 'box' #176

Open
ksenthilkumarnissi opened this issue Dec 2, 2021 · 0 comments
Open

'str' object has no attribute 'box' #176

ksenthilkumarnissi opened this issue Dec 2, 2021 · 0 comments

Comments

@ksenthilkumarnissi
Copy link

""In transformFromNative, unhandled exception on line None <class 'AttributeError'>: 'str' object has no attribute 'box'""}

Code:

def getVCard(request, id):

            card = vobject.vCard()

            attr = card.add('N')
            attr.value = vobject.vcard.Name(family='', given=serializer_class.data['profile_full_name'])

            attr = card.add('FN')
            attr.value = serializer_class.data['profile_full_name']
            
            attr = card.add('NICKNAME')
            attr.value = serializer_class.data['profile_full_name']
            
            attr = card.add('EMAIL')
            attr.value = attr.value = serializer_class.data['profile_email'] 

            attr = card.add('TEL')
            attr.type_param = 'cell'
            attr.value = serializer_class.data['profile_mobile_number']
            
            attr = card.add('SOURCE')
            attr.type_param = get_current_site(request).domain + '/vcard/' + id

            attr = card.add('ROLE')
            attr.value = serializer_class.data['profile_designation']

            attr = card.add('REV')
            attr.value = datetime.now
            
            attr = card.add('ORG')
            attr.value =  serializer_class.data['profile_company_name']
           

            photo_url = settings.AWS_S3_CUSTOM_DOMAIN + serializer_class.data['profile_picture']
            
            
            attr = card.add('PHOTO')
            attr.value_param = "URI"
            attr.type_param = 'jpg'
            attr.value = photo_url
    
            attr = card.add('LOGO')
            attr.type_param = "jpg"
            attr.value = photo_url
    
            attr = card.add('KIND')
            attr.value = "individual"
    
            attr = card.add('GENDER')
            attr.value = "M"
    
            attr = card.add('CATEGORIES')
            attr.value = ("swimmer","biker","business")
            
            attr = card.add('URL')
            attr.value = serializer_class.data['profile_website']

            attr = card.add('TITLE')
            attr.value = serializer_class.data['profile_profession']

            attr = card.add('CLASS')
            attr.value = "public"

            attr = card.add('NOTE')
            attr.value = "I am the Member"

            attr = card.add('TZ')
            attr.value = timezone.get_current_timezone

            attr = card.add('ADR')
            attr.type_param = "work"
            attr.value = serializer_class.data['profile_company_address']


            response = HttpResponse(content_type='text/x-vcard')
            response['Content-Disposition'] = 'attachment; filename=" %s.vcf"' % serializer_class.data['profile_full_name']
            response.write(card.serialize())
            return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant