Revision 804e8fe7 pithos/api/util.py

b/pithos/api/util.py
59 59
logger = logging.getLogger(__name__)
60 60

  
61 61

  
62
def rename_meta_key(d, old, new):
63
    if old not in d:
64
        return
65
    d[new] = d[old]
66
    del(d[old])
67

  
62 68
def printable_header_dict(d):
63 69
    """Format a meta dictionary for printing out json/xml.
64 70
    
65
    Convert all keys to lower case and replace dashes to underscores.
66
    Change 'modified' key from backend to 'last_modified' and format date.
71
    Convert all keys to lower case and replace dashes with underscores.
72
    Format 'last_modified' timestamp.
67 73
    """
68 74
    
69
    if 'modified' in d:
70
        d['last_modified'] = datetime.datetime.fromtimestamp(int(d['modified'])).isoformat()
71
        del(d['modified'])
75
    d['last_modified'] = datetime.datetime.fromtimestamp(int(d['last_modified'])).isoformat()
72 76
    return dict([(k.lower().replace('-', '_'), v) for k, v in d.iteritems()])
73 77

  
74 78
def format_header_key(k):

Also available in: Unified diff