def diff(self): try: old = api.get_attachment_info(self.info['history'][-2]['attachment_id']).raw_size except (IndexError, KeyError): return None new = self.raw_size delta = new - old if delta > 0: return '+%s' % api.sizeof(delta) else: return '-%s' % api.sizeof(abs(delta))
def size(self): return api.sizeof(self.raw_size)
def size(self): return api.sizeof(self.info.get('size', 0))
def img_bytes(self): return api.sizeof(self.info.get('img_bytes'))