Add ternaire condition
This commit is contained in:
parent
eb4982f94a
commit
891d2c22d6
|
@ -37,10 +37,7 @@ class ReadFromCesium:
|
||||||
|
|
||||||
# Configure JSON document to send
|
# Configure JSON document to send
|
||||||
def configDoc(self, nbrMsg, outbox):
|
def configDoc(self, nbrMsg, outbox):
|
||||||
if outbox:
|
boxType = "issuer" if outbox else "recipient"
|
||||||
boxType = "issuer"
|
|
||||||
else:
|
|
||||||
boxType = "recipient"
|
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
data['sort'] = { "time": "desc" }
|
data['sort'] = { "time": "desc" }
|
||||||
|
@ -57,10 +54,7 @@ class ReadFromCesium:
|
||||||
return document
|
return document
|
||||||
|
|
||||||
def sendDocument(self, nbrMsg, outbox):
|
def sendDocument(self, nbrMsg, outbox):
|
||||||
if outbox:
|
boxType = "outbox" if outbox else "inbox"
|
||||||
boxType = "outbox"
|
|
||||||
else:
|
|
||||||
boxType = "inbox"
|
|
||||||
|
|
||||||
document = self.configDoc(nbrMsg, outbox)
|
document = self.configDoc(nbrMsg, outbox)
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -194,10 +188,7 @@ class SendToCesium:
|
||||||
|
|
||||||
|
|
||||||
def sendDocument(self, document):
|
def sendDocument(self, document):
|
||||||
if self.outbox:
|
boxType = "outbox" if self.outbox else "inbox"
|
||||||
boxType = "outbox"
|
|
||||||
else:
|
|
||||||
boxType = "inbox"
|
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'Content-type': 'application/json',
|
'Content-type': 'application/json',
|
||||||
|
@ -250,14 +241,9 @@ class DeleteFromCesium:
|
||||||
# Get current timestamp
|
# Get current timestamp
|
||||||
timeSent = int(time.time())
|
timeSent = int(time.time())
|
||||||
|
|
||||||
|
boxType = "outbox" if self.outbox else "inbox"
|
||||||
|
|
||||||
# Generate document to customize
|
# Generate document to customize
|
||||||
|
|
||||||
if self.outbox:
|
|
||||||
boxType = "outbox"
|
|
||||||
else:
|
|
||||||
boxType = "inbox"
|
|
||||||
|
|
||||||
#document = str({"version":2,"index":"message","type":boxType,"id":idMsg,"issuer":self.issuer,"time":timeSent}).replace("'",'"')
|
|
||||||
data = {}
|
data = {}
|
||||||
data['version'] = 2
|
data['version'] = 2
|
||||||
data['index'] = "message"
|
data['index'] = "message"
|
||||||
|
|
Loading…
Reference in New Issue