~mfoord/ubuntu-sso-client/password-policy-error

« back to all changes in this revision

Viewing changes to ubuntu_sso/constants.py.in

  • Committer: Tarmac
  • Author(s): Rodney Dawes
  • Date: 2013-06-12 16:04:29 UTC
  • mfrom: (1032.1.1 move-u1-constants)
  • Revision ID: tarmac-20130612160429-urm7ew2ox33oj4a0
Move the U1 SSO constants values to constants.py.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
"""
34
34
 
35
35
import os
 
36
import platform
 
37
import urllib
 
38
 
 
39
from ubuntu_sso import SSO_UONE_BASE_URL
36
40
 
37
41
VERSION = '@VERSION@'
38
42
PROJECT_NAME = '@PROJECT_NAME@'
39
43
PROJECT_DIR = os.path.join('@prefix@', 'share', PROJECT_NAME)
40
44
BIN_DIR = os.path.join('@prefix@', 'lib', PROJECT_NAME)
 
45
 
 
46
# Ubuntu One sso constants
 
47
APP_NAME = u"Ubuntu One"
 
48
TC_URL = u"%s/terms/" % SSO_UONE_BASE_URL
 
49
POLICY_URL = u"%s/privacy/" % SSO_UONE_BASE_URL
 
50
BASE_PING_URL = \
 
51
    u"%s/oauth/sso-finished-so-get-tokens/{email}" % SSO_UONE_BASE_URL
 
52
 
 
53
 
 
54
def platform_data():
 
55
    result = {'platform': platform.system(),
 
56
              'platform_version': platform.release(),
 
57
              'platform_arch': platform.machine(),
 
58
              'client_version': VERSION}
 
59
    # urlencode will not encode unicode, only bytes
 
60
    result = urllib.urlencode(result)
 
61
    return result
 
62
 
 
63
# the result of platform_data is given by urlencode, encoded with ascii
 
64
PING_URL = BASE_PING_URL + u"?" + platform_data().decode('ascii')