~smoser/ubuntu/saucy/maas/lp1287772

« back to all changes in this revision

Viewing changes to src/maasserver/management/commands/apikey.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-06-13 20:06:35 UTC
  • mfrom: (1.2.10)
  • Revision ID: package-import@ubuntu.com-20130613200635-dqxm94ymg03xpmwf
Tags: 1.4+bzr1538+dfsg-0ubuntu1
* New upstream release
* debian/patches/04-setup-dont-user-list-snippets.patch: Drop. Merged
  Upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    convert_string_to_tuple,
20
20
    convert_tuple_to_string,
21
21
    )
 
22
import django
22
23
from django.contrib.auth.models import User
23
24
from django.core.management.base import (
24
25
    BaseCommand,
44
45
    def _print_token(self, token):
45
46
        """Write `token` to stdout in the standard format."""
46
47
        self.stdout.write(convert_tuple_to_string(get_creds_tuple(token)))
47
 
        self.stdout.write('\n')
 
48
        # In Django 1.5+, self.stdout.write() adds a newline character at
 
49
        # the end of the message.
 
50
        if django.VERSION < (1, 5):
 
51
            self.stdout.write('\n')
48
52
 
49
53
    def _generate_token(self, user):
50
54
        _, token = user.get_profile().create_authorisation_token()