Revision f546c15e tools/store

b/tools/store
40 40
from datetime import datetime
41 41
from lib.client import Pithos_Client, Fault
42 42
from lib.util import get_user, get_auth, get_server, get_api
43
from lib.transfer import upload
43
from lib.transfer import upload, download
44 44

  
45 45
import json
46 46
import logging
......
204 204
    
205 205
    def execute(self, path=''):
206 206
        container, sep, object = path.partition('/')
207
        args = {'restricted':self.restricted}
207
        args = {'restricted': self.restricted}
208 208
        if getattr(self, 'until'):
209 209
            t = _time.strptime(self.until, self.format)
210 210
            args['until'] = int(_time.mktime(t))
......
299 299
        args = self._build_args(attrs)
300 300
        args['format'] = 'json' if self.detail else 'text'
301 301
        if self.range:
302
            args['range'] = 'bytes=%s' %self.range
302
            args['range'] = 'bytes=%s' % self.range
303 303
        if getattr(self, 'if_range'):
304 304
            args['if-range'] = 'If-Range:%s' % getattr(self, 'if_range')
305 305
        
......
690 690
class Send(Command):
691 691
    syntax = '<file> <container>[/<prefix>]'
692 692
    description = 'upload file to container (using prefix)'
693
        
694
    def execute(self, file, prefix):
695
        container, sep, prefix = prefix.partition('/')
693
    
694
    def execute(self, file, path):
695
        container, sep, prefix = path.partition('/')
696 696
        upload(self.client, file, container, prefix)
697 697

  
698
@cli_command('receive')
699
class Receive(Command):
700
    syntax = '<container>/<object> <file>'
701
    description = 'download object to file'
702
    
703
    def execute(self, path, file):
704
        container, sep, object = path.partition('/')
705
        download(self.client, container, object, file)
706

  
698 707
def print_usage():
699 708
    cmd = Command('', [])
700 709
    parser = cmd.parser

Also available in: Unified diff