[hub] fix merge conflicts

This commit is contained in:
Prateeksha Singh
2018-08-21 21:00:53 +05:30
7 changed files with 29 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
import frappe, io, base64, urllib, os
import frappe, io, base64, urllib, os, json
from frappe.utils.file_manager import get_file_path
def pre_process(doc):
@@ -9,11 +10,17 @@ def pre_process(doc):
url = file_path
file_path = os.path.join('/tmp', file_name)
urllib.urlretrieve(url, file_path)
else:
file_path = os.path.abspath(get_file_path(file_path))
with io.open(file_path, 'rb') as f:
doc.image = base64.b64encode(f.read())
doc.image_file_name = file_name
try:
with io.open(file_path, 'rb') as f:
doc.image = json.dumps({
'file_name': file_name,
'base64': base64.b64encode(f.read())
})
except Exception as e:
frappe.log_error(title='Hub Sync Error')
cached_details = frappe.get_doc('Hub Tracked Item', doc.item_code)

View File

@@ -67,6 +67,7 @@ class HubSettings(Document):
def create_hub_connector(self, message):
if frappe.db.exists('Data Migration Connector', 'Hub Connector'):
hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector')
hub_connector.hostname = self.get_hub_url()
hub_connector.username = message['email']
hub_connector.password = message['password']
hub_connector.save()

View File

@@ -1,23 +0,0 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Hub Tracked Item", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Hub Tracked Item
() => frappe.tests.make('Hub Tracked Item', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});