|
|
|
@ -217,9 +217,9 @@ class Parser (Process):
|
|
|
|
|
self._custom_config = self.get_custom(path)
|
|
|
|
|
self.config = _config['parser']
|
|
|
|
|
self.store = _config['store']
|
|
|
|
|
|
|
|
|
|
self.files = []
|
|
|
|
|
self.set = void()
|
|
|
|
|
self.cache = {}
|
|
|
|
|
self.files = []
|
|
|
|
|
self.set = void()
|
|
|
|
|
self.set.files = self.set_files
|
|
|
|
|
self.emit = void()
|
|
|
|
|
self.emit.pre = None
|
|
|
|
@ -349,6 +349,24 @@ class Parser (Process):
|
|
|
|
|
# object_value = {label:object_value}
|
|
|
|
|
|
|
|
|
|
return object_value
|
|
|
|
|
def set_cache(self,tmp,_info) :
|
|
|
|
|
"""
|
|
|
|
|
insert into cache a value that the, these are in reference to a loop
|
|
|
|
|
"""
|
|
|
|
|
if 'cache' in _info :
|
|
|
|
|
key = _info['cache']['key']
|
|
|
|
|
value=_info['cache']['value']
|
|
|
|
|
field = _info['cache']['field']
|
|
|
|
|
if value in tmp :
|
|
|
|
|
self.cache [key] = {field:tmp[value]}
|
|
|
|
|
pass
|
|
|
|
|
def get_cache(self,row) :
|
|
|
|
|
"""
|
|
|
|
|
retrieve cache element for a current
|
|
|
|
|
"""
|
|
|
|
|
key = row[0]
|
|
|
|
|
return self.cache[key] if key in self.cache else {}
|
|
|
|
|
pass
|
|
|
|
|
def apply(self,content,_code) :
|
|
|
|
|
"""
|
|
|
|
|
:content content of a file i.e a segment with the envelope
|
|
|
|
@ -375,12 +393,15 @@ class Parser (Process):
|
|
|
|
|
|
|
|
|
|
_info = jsonmerge.merge(_info,_cinfo)
|
|
|
|
|
tmp = self.get.value(row,_info)
|
|
|
|
|
#
|
|
|
|
|
# let's prune the objects not found
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not tmp :
|
|
|
|
|
continue
|
|
|
|
|
#
|
|
|
|
|
# At this point we have the configuration and the row parsed into values
|
|
|
|
|
# We should check to see if we don't have anything in the cache to be added to it
|
|
|
|
|
#
|
|
|
|
|
if row[0] in self.cache :
|
|
|
|
|
tmp = jsonmerge.merge(tmp,self.get_cache(row))
|
|
|
|
|
|
|
|
|
|
if 'label' in _info :
|
|
|
|
|
label = _info['label']
|
|
|
|
@ -417,7 +438,15 @@ class Parser (Process):
|
|
|
|
|
print (e.args[0])
|
|
|
|
|
# print ('__',(dir(e.args)))
|
|
|
|
|
pass
|
|
|
|
|
#
|
|
|
|
|
# At this point the object is completely built,
|
|
|
|
|
# if there ar any attributes to be cached it will be done here
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
if 'cache' in _info :
|
|
|
|
|
|
|
|
|
|
self.set_cache(tmp,_info)
|
|
|
|
|
|
|
|
|
|
return value if value else {}
|
|
|
|
|
|
|
|
|
|
def get_default_value(self,content,_code):
|
|
|
|
|