def store_association(cls, server_url, association): from social_auth.models import Association args = {'server_url': server_url, 'handle': association.handle} try: assoc = Association.objects.get(**args) except Association.DoesNotExist: assoc = Association(**args) assoc.secret = base64.encodestring(association.secret) assoc.issued = association.issued assoc.lifetime = association.lifetime assoc.assoc_type = association.assoc_type assoc.save()
def storeAssociation(self, server_url, association): """Store new assocition if doesn't exist""" args = {'server_url': server_url, 'handle': association.handle} try: assoc = Association.objects.get(**args) except Association.DoesNotExist: assoc = Association(**args) assoc.secret = base64.encodestring(association.secret) assoc.issued = association.issued assoc.lifetime = association.lifetime assoc.assoc_type = association.assoc_type assoc.save()