Revision d3fd269f

b/pithos/lib/client.py
258 258
    def delete_account_metadata(self, meta=[]):
259 259
        self._delete_metadata('', 'account', meta)
260 260
    
261
    def set_account_groups(self, groups):
262
        headers = {}
263
        for key, val in groups.items():
264
            headers['X-Account-Group-%s' % key.capitalize()] = val
265
        self.post('', headers=headers)
266
    
261 267
    # Storage Container Services
262 268
    
263 269
    def _filter(self, l, d):
b/tools/store
326 326
        parser.add_option('--touch', action='store_true',
327 327
                          dest='touch', default=False,
328 328
                          help='create object with zero data')
329
    
329
        parser.add_option('--sharing', action='store',
330
                          dest='sharing', default=None,
331
                          help='define sharing object policy')
332
        
330 333
    def execute(self, path, srcpath='-', *args):
331 334
        headers = {}
332 335
        if self.manifest:
333 336
            headers['X_OBJECT_MANIFEST'] = self.manifest
337
        if self.sharing:
338
            headers['X_OBJECT_SHARING'] = self.sharing
334 339
        
335 340
        attrs = ['etag', 'content-encoding', 'content-disposition',
336 341
                 'content-type']
......
425 430
                          help='provide the presentation style of the object')
426 431
        parser.add_option('--manifest', action='store', type='str',
427 432
                          dest='manifest', default=None,
428
                          help='use for large file support')
433
                          help='use for large file support')        
434
        parser.add_option('--sharing', action='store',
435
                          dest='sharing', default=None,
436
                          help='define sharing object policy')
437

  
429 438
    
430 439
    def execute(self, path, srcpath='-', *args):
431 440
        headers = {}
432 441
        if self.manifest:
433 442
            headers['X_OBJECT_MANIFEST'] = self.manifest
443
        if self.sharing:
444
            headers['X_OBJECT_SHARING'] = self.sharing
434 445
        
435 446
        if getattr(self, 'start'):
436 447
            headers['CONTENT_RANGE'] = 'bytes %s-/*' % getattr(self, 'start')
......
513 524
        else:
514 525
            self.client.delete_account_metadata(meta)
515 526

  
527
@cli_command('group')
528
class SetGroup(Command):
529
    syntax = 'key=val [key=val] [...]'
530
    description = 'sets group account info'
531
    
532
    def execute(self, path='', **args):
533
        if len(args) == 0:
534
            args = list(args)
535
            args.append(path)
536
            args = tuple(args)
537
            path = ''
538
        groups = {}
539
        for arg in args:
540
            key, sep, val = arg.partition('=')
541
            groups[key] = val
542
        self.client.set_account_groups(groups)
543

  
516 544
def print_usage():
517 545
    cmd = Command([])
518 546
    parser = cmd.parser
......
576 604
    try:
577 605
        cmd.execute(*cmd.args)
578 606
    except TypeError, e:
579
        print e
580 607
        cmd.parser.usage = '%%prog %s [options] %s' % (name, cmd.syntax)
581 608
        cmd.parser.print_help()
582 609
        exit(1)
583 610
    except Fault, f:
584
        print f.status, f.data
585 611
        status = f.status and '%s ' % f.status or ''
586 612
        print '%s%s' % (status, f.data)
587 613

  

Also available in: Unified diff