Esempio n. 1
0
    def get_field_mapping(self, field_map):
	new_field = {}
	table_name = None

	for f in field_map:
	    if f["field_id"] and f["site_field"]:
		if table_name is None:
		    table_name = f["table_name"]

		new_field[f["site_field"]] = get_field_from_cache(f["field_id"])
	
	return table_name, new_field
Esempio n. 2
0
    def getItemGUID(self, data):
	guid_rule = self.guid_rule
	s = "";

	if isinstance(guid_rule, list):
	    for field_id in guid_rule:
		field = get_field_from_cache(field_id)
		if field:
		    field_name = field["name"]
		    if field_name and data[field_name]:
			if "value" in data[field_name] and data[field_name].value:
			    s += safestr(data[field_name].value)
			elif data[field_name] and isinstance(data[field_name], unicode) and isinstance(data[field_name], str):
			    s += safestr(data[field_name])

	elif isinstance(guid_rule, str) or isinstance(guid_rule, unicode):
	    s = data[guid_rule]

	return md5(s).hexdigest()