mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 13:38:27 +00:00
[hub] profile email uneditable, style additions, base64 sync enable
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user