mirror of https://github.com/MISP/misp-dashboard
fix: [helpers] Changed string formating to `format` and slight refact
parent
f009d81321
commit
f2fb36601a
|
@ -100,7 +100,7 @@ class Contributor_helper:
|
||||||
self.DICO_PNTS_REWARD[categ] = self.default_pnts_per_contribution
|
self.DICO_PNTS_REWARD[categ] = self.default_pnts_per_contribution
|
||||||
|
|
||||||
self.rankMultiplier = self.cfg_org_rank.getfloat('monthlyRanking' ,'rankMultiplier')
|
self.rankMultiplier = self.cfg_org_rank.getfloat('monthlyRanking' ,'rankMultiplier')
|
||||||
self.levelMax = self.cfg_org_rank.getint('monthlyRanking' ,'levelMax')
|
self.levelMax = self.cfg_org_rank.getint('monthlyRanking', 'levelMax')
|
||||||
|
|
||||||
# REDIS KEYS
|
# REDIS KEYS
|
||||||
self.keyDay = KEYDAY
|
self.keyDay = KEYDAY
|
||||||
|
@ -111,7 +111,6 @@ class Contributor_helper:
|
||||||
self.keyTrophy = "CONTRIB_TROPHY"
|
self.keyTrophy = "CONTRIB_TROPHY"
|
||||||
self.keyLastAward = "CONTRIB_LAST_AWARDS"
|
self.keyLastAward = "CONTRIB_LAST_AWARDS"
|
||||||
|
|
||||||
|
|
||||||
''' HELPER '''
|
''' HELPER '''
|
||||||
def getOrgLogoFromMISP(self, org):
|
def getOrgLogoFromMISP(self, org):
|
||||||
return "{}/img/orgs/{}.png".format(self.misp_web_url, org)
|
return "{}/img/orgs/{}.png".format(self.misp_web_url, org)
|
||||||
|
@ -123,7 +122,7 @@ class Contributor_helper:
|
||||||
self.logger.debug('Added to redis: keyname={}, org={}, count={}'.format(keyname, org, count))
|
self.logger.debug('Added to redis: keyname={}, org={}, count={}'.format(keyname, org, count))
|
||||||
|
|
||||||
def publish_log(self, zmq_name, name, content, channel=""):
|
def publish_log(self, zmq_name, name, content, channel=""):
|
||||||
to_send = { 'name': name, 'log': json.dumps(content), 'zmqName': zmq_name }
|
to_send = {'name': name, 'log': json.dumps(content), 'zmqName': zmq_name }
|
||||||
self.serv_log.publish(channel, json.dumps(to_send))
|
self.serv_log.publish(channel, json.dumps(to_send))
|
||||||
self.logger.debug('Published: {}'.format(json.dumps(to_send)))
|
self.logger.debug('Published: {}'.format(json.dumps(to_send)))
|
||||||
|
|
||||||
|
|
|
@ -208,9 +208,10 @@ class Geo_helper:
|
||||||
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
|
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
|
||||||
print("To test for support: echo \"help GEOADD\"| redis-cli")
|
print("To test for support: echo \"help GEOADD\"| redis-cli")
|
||||||
self.logger.debug('Added to redis: keyname={}, lon={}, lat={}, content={}'.format(keyname, lon, lat, content))
|
self.logger.debug('Added to redis: keyname={}, lon={}, lat={}, content={}'.format(keyname, lon, lat, content))
|
||||||
|
|
||||||
def push_to_redis_zset(self, keyCateg, toAdd, endSubkey="", count=1):
|
def push_to_redis_zset(self, keyCateg, toAdd, endSubkey="", count=1):
|
||||||
if not isinstance(toAdd, str):
|
if not isinstance(toAdd, str):
|
||||||
self.logger.warning(f'Can\'t add to redis, element is not of type String. {type(toAdd)}')
|
self.logger.warning('Can\'t add to redis, element is not of type String. {}'.format(type(toAdd)))
|
||||||
return
|
return
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
today_str = util.getDateStrFormat(now)
|
today_str = util.getDateStrFormat(now)
|
||||||
|
|
Loading…
Reference in New Issue