~wgrant/canonical-identity-provider/lp-xmlrpc

« back to all changes in this revision

Viewing changes to identityprovider/utils.py

  • Committer: William Grant
  • Date: 2012-01-15 21:03:49 UTC
  • Revision ID: william.grant@canonical.com-20120115210349-ae596shxhptz0ycj
Clean logging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import binascii
5
5
import hashlib
6
6
import httplib
7
 
import logging
8
7
import random
9
8
import re
10
9
import urllib
16
15
from email.Utils import formataddr
17
16
 
18
17
from django.core.exceptions import ObjectDoesNotExist
 
18
from django.utils.log import getLogger
19
19
from django.utils.translation import ugettext as _
20
20
 
21
21
SALT_LENGTH = 20
191
191
 
192
192
 
193
193
def get_launchpad_details_for_user(user):
194
 
    from django.utils.log import getLogger
195
194
    endpoint = 'http://xmlrpc-private.launchpad.dev:8087/canonicalsso'
196
195
    proxy = xmlrpclib.ServerProxy(
197
196
        endpoint, transport=Transport(timeout=0.5))
199
198
        details = proxy.getPersonByOpenIDIdentifier(
200
199
            user.openid_identifier.split('/')[-1])
201
200
    except socket.error:
202
 
        getLogger('django.request').exception(
203
 
            "Failed to retrieve details from Launchpad.")
 
201
        getLogger().exception("Failed to retrieve details from Launchpad.")
204
202
        details = None
205
203
    return details