Changeset 119412d in OpenWorkouts-current


Ignore:
Timestamp:
Jan 9, 2019, 12:31:39 PM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
b73ae09
Parents:
53bb3e5
Message:

Modify create_blob() so we can tell if we want to create a blob from binary

content or not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/utilities.py

    r53bb3e5 r119412d  
    172172
    173173
    174 def create_blob(data, file_extension):
     174def create_blob(data, file_extension, binary=False):
    175175    """
    176176    Create a ZODB blob file from some data, return the blob object
     
    180180    with blob.open('w') as open_blob:
    181181        # use .encode() to convert the string to bytes if needed
    182         if not isinstance(data, bytes):
     182        if not binary and not isinstance(data, bytes):
    183183            data = data.encode('utf-8')
    184184        open_blob.write(data)
Note: See TracChangeset for help on using the changeset viewer.