[hub] profile email uneditable, style additions, base64 sync enable

This commit is contained in:
Prateeksha Singh
2018-08-21 17:43:30 +05:30
parent d17aedb719
commit b0a3a106fc
4 changed files with 17 additions and 12 deletions

View File

@@ -2,18 +2,18 @@ import frappe, io, base64, urllib, os
def pre_process(doc):
# file_path = doc.image
# file_name = os.path.basename(file_path)
file_path = doc.image
file_name = os.path.basename(file_path)
# if file_path.startswith('http'):
# url = file_path
# file_path = os.path.join('/tmp', file_name)
# urllib.urlretrieve(url, file_path)
if file_path.startswith('http'):
url = file_path
file_path = os.path.join('/tmp', file_name)
urllib.urlretrieve(url, file_path)
# with io.open(file_path, 'rb') as f:
# doc.image = base64.b64encode(f.read())
with io.open(file_path, 'rb') as f:
doc.image = base64.b64encode(f.read())
# doc.image_file_name = file_name
doc.image_file_name = file_name
cached_details = frappe.get_doc('Hub Tracked Item', doc.item_code)