cubicweb/web/test/data/cubicweb_file/entities.py
changeset 12567 26744ad37953
parent 12519 aff5d3498f68
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
     1 from six import text_type
       
     2 from logilab.mtconverter import guess_mimetype_and_encoding
     1 from logilab.mtconverter import guess_mimetype_and_encoding
     3 from cubicweb.entities import AnyEntity, fetch_config
     2 from cubicweb.entities import AnyEntity, fetch_config
     4 
     3 
     5 
     4 
     6 class File(AnyEntity):
     5 class File(AnyEntity):
    40                 # want to consider explicitly specified values, not old ones
    39                 # want to consider explicitly specified values, not old ones
    41                 filename=self.cw_edited.get('data_name'),
    40                 filename=self.cw_edited.get('data_name'),
    42                 format=format, encoding=encoding,
    41                 format=format, encoding=encoding,
    43                 fallbackencoding=self._cw.encoding)
    42                 fallbackencoding=self._cw.encoding)
    44             if format:
    43             if format:
    45                 self.cw_edited['data_format'] = text_type(format)
    44                 self.cw_edited['data_format'] = str(format)
    46             if encoding:
    45             if encoding:
    47                 self.cw_edited['data_encoding'] = text_type(encoding)
    46                 self.cw_edited['data_encoding'] = str(encoding)
    48 
    47 
    49 
    48 
    50 class UnResizeable(Exception):
    49 class UnResizeable(Exception):
    51     pass
    50     pass