Add attachments to proofs calc in export cli call

This commit is contained in:
nolash 2021-10-22 19:41:01 +02:00
parent eb42095a74
commit d245f98cbd
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 10 additions and 4 deletions

View File

@ -59,7 +59,6 @@ class Attachment(Data):
def __str__(self): def __str__(self):
s = '' s = ''
#for i in range(len(self.contents)):
for k in self.contents.keys(): for k in self.contents.keys():
s += '{} = {}\n'.format(k, self.contents[k]) #self.digests[i].hex(), self.contents[i]) s += '{} = {}\n'.format(k, self.contents[k]) #self.digests[i].hex(), self.contents[i])

View File

@ -80,10 +80,10 @@ def execute(config, eargs):
cp = Proof(path=eargs.directory, attachments=ca, writer=writers['proof'](path=output_writer_path_meta)) cp = Proof(path=eargs.directory, attachments=ca, writer=writers['proof'](path=output_writer_path_meta))
cn = Network(path=eargs.directory) cn = Network(path=eargs.directory)
ca.load()
ct.load() ct.load()
cp.load() cp.load()
cm.load() cm.load()
ca.load()
cn.load() cn.load()
chain_spec = None chain_spec = None

View File

@ -54,7 +54,7 @@ class HTTPWriter(OutputWriter):
logg.debug('http writer post {}'.format(path)) logg.debug('http writer post {}'.format(path))
rq = urllib.request.Request(path, method='POST', data=v) rq = urllib.request.Request(path, method='POST', data=v)
r = urllib.request.urlopen(rq) r = urllib.request.urlopen(rq)
logg.info('proof submited at {}'.format(r.read())) logg.info('http writer submitted at {}'.format(r.read()))
class KeyedWriter(OutputWriter): class KeyedWriter(OutputWriter):

View File

@ -44,6 +44,7 @@ class Proof(Data):
self.description = o['description'] self.description = o['description']
self.namespace = o['namespace'] self.namespace = o['namespace']
self.issuer = o['issuer'] self.issuer = o['issuer']
self.proofs = o['proofs']
if self.extra_attachments != None: if self.extra_attachments != None:
a = self.extra_attachments.asdict() a = self.extra_attachments.asdict()
@ -111,6 +112,7 @@ class Proof(Data):
if writer == None: if writer == None:
writer = self.writer writer = self.writer
(k, v) = self.root() (k, v) = self.root()
writer.write(k, v) writer.write(k, v)
@ -139,6 +141,11 @@ class Proof(Data):
#writer.write(r_hex, hshs_cat) #writer.write(r_hex, hshs_cat)
o = self.asdict()
f = open(self.proof_path, 'w')
json.dump(o, f, sort_keys=True, indent="\t")
f.close()
return k return k