Revision 32454501 snf-pithos-tools/pithos/tools/sh.py
b/snf-pithos-tools/pithos/tools/sh.py | ||
---|---|---|
39 | 39 |
from sys import argv, exit, stdin, stdout |
40 | 40 |
from datetime import datetime |
41 | 41 |
|
42 |
from django.core.validators import email_re |
|
43 |
|
|
42 | 44 |
from pithos.tools.lib.client import Pithos_Client, Fault |
43 | 45 |
from pithos.tools.lib.util import get_user, get_auth, get_url |
44 | 46 |
from pithos.tools.lib.transfer import upload, download |
... | ... | |
52 | 54 |
|
53 | 55 |
_cli_commands = {} |
54 | 56 |
|
55 |
|
|
56 | 57 |
def cli_command(*args): |
57 | 58 |
def decorator(cls): |
58 | 59 |
cls.commands = args |
... | ... | |
93 | 94 |
val = getattr(options, key) |
94 | 95 |
setattr(self, key, val) |
95 | 96 |
|
97 |
if email_re.match(self.user): |
|
98 |
try: |
|
99 |
from synnefo.lib.astakos import get_user_uuid |
|
100 |
from pithos.api.settings import SERVICE_TOKEN |
|
101 |
self.user = get_user_uuid(SERVICE_TOKEN, self.user) |
|
102 |
except ImportError: |
|
103 |
pass |
|
96 | 104 |
self.client = Pithos_Client( |
97 | 105 |
self.url, self.token, self.user, self.verbose, |
98 | 106 |
self.debug) |
... | ... | |
763 | 771 |
attrs = ['limit', 'marker'] |
764 | 772 |
args = self._build_args(attrs) |
765 | 773 |
args['format'] = 'json' if self.detail else 'text' |
774 |
args['translate'] = '' |
|
766 | 775 |
|
767 |
print_list(self.client.list_shared_by_others(**args))
|
|
776 |
print_list(self.client.list_shared_with_me(**args))
|
|
768 | 777 |
|
769 | 778 |
|
770 | 779 |
@cli_command('send') |
Also available in: Unified diff