Ver a proveniência

Merge pull request #11405 from rmehta/move-get-source

fix(minor): move get_source_value to data_migration_mapper
version-14
Rushabh Mehta há 4 anos
committed by GitHub
ascendente
cometimento
f6a486a487
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: 4AEE18F83AFDEB23
3 ficheiros alterados com 9 adições e 9 eliminações
  1. +7
    -1
      frappe/data_migration/doctype/data_migration_mapping/data_migration_mapping.py
  2. +2
    -1
      frappe/data_migration/doctype/data_migration_run/data_migration_run.py
  3. +0
    -7
      frappe/utils/data.py

+ 7
- 1
frappe/data_migration/doctype/data_migration_mapping/data_migration_mapping.py Ver ficheiro

@@ -5,7 +5,6 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import get_source_value

class DataMigrationMapping(Document):
def get_filters(self):
@@ -70,3 +69,10 @@ def get_value_from_fieldname(field_map, fieldname_field, doc):
else:
value = get_source_value(doc, field_name)
return value

def get_source_value(source, key):
'''Get value from source (object or dict) based on key'''
if isinstance(source, dict):
return source.get(key)
else:
return getattr(source, key)

+ 2
- 1
frappe/data_migration/doctype/data_migration_run/data_migration_run.py Ver ficheiro

@@ -6,7 +6,8 @@ from __future__ import unicode_literals
import frappe, json, math
from frappe.model.document import Document
from frappe import _
from frappe.utils import get_source_value, cstr
from frappe.utils import cstr
from frappe.data_migration.doctype.data_migration_mapping.data_migration_mapping import get_source_value

class DataMigrationRun(Document):
def run(self):


+ 0
- 7
frappe/utils/data.py Ver ficheiro

@@ -1226,13 +1226,6 @@ def md_to_html(markdown_text):

return html

def get_source_value(source, key):
'''Get value from source (object or dict) based on key'''
if isinstance(source, dict):
return source.get(key)
else:
return getattr(source, key)

def is_subset(list_a, list_b):
'''Returns whether list_a is a subset of list_b'''
return len(list(set(list_a) & set(list_b))) == len(list_a)


Carregando…
Cancelar
Guardar