clean Flask_tags + gitignore

This commit is contained in:
Terrtia 2018-06-01 13:36:08 +02:00
parent 4a7c163df7
commit c41a56e4a2
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 24 additions and 26 deletions

13
.gitignore vendored
View file

@ -7,10 +7,15 @@
AILENV AILENV
redis-leveldb redis-leveldb
redis redis
ardb
faup
tlsh
Blooms Blooms
LEVEL_DB_DATA LEVEL_DB_DATA
PASTES PASTES
bin/indexdir/ BASE64
DATA_ARDB
indexdir/
logs/ logs/
# Webstuff # Webstuff
@ -20,7 +25,7 @@ var/www/static/
!var/www/static/js/moduleTrending.js !var/www/static/js/moduleTrending.js
!var/www/static/js/plot-graph.js !var/www/static/js/plot-graph.js
!var/www/static/js/trendingchart.js !var/www/static/js/trendingchart.js
var/www/templates/header.html # auto-generated var/www/templates/header.html
# Local config # Local config
bin/packages/config.cfg bin/packages/config.cfg
@ -28,4 +33,6 @@ bin/packages/config.cfg
# installed files # installed files
nltk_data/ nltk_data/
doc/all_modules.txt doc/all_modules.txt
doc/module-data-flow.png # auto-generated # auto generated
doc/module-data-flow.png
doc/data-flow.png

View file

@ -52,6 +52,18 @@ for name, tags in clusters.items(): #galaxie name + tags
def one(): def one():
return 1 return 1
def get_tags_with_synonyms(tag):
str_synonyms = ' - synonyms: '
synonyms = r_serv_tags.smembers('synonym_tag_' + tag)
# synonyms to display
for synonym in synonyms:
str_synonyms = str_synonyms + synonym + ', '
# add real tag
if str_synonyms != ' - synonyms: ':
return {'name':tag + str_synonyms,'id':tag}
else:
return {'name':tag,'id':tag}
# ============= ROUTES ============== # ============= ROUTES ==============
@Tags.route("/Tags/", methods=['GET']) @Tags.route("/Tags/", methods=['GET'])
@ -106,16 +118,7 @@ def get_all_tags_galaxy():
for galaxy in active_galaxies: for galaxy in active_galaxies:
l_tags = r_serv_tags.smembers('active_tag_galaxies_' + galaxy) l_tags = r_serv_tags.smembers('active_tag_galaxies_' + galaxy)
for tag in l_tags: for tag in l_tags:
str_synonyms = ' - synonyms: ' list_tags.append(get_tags_with_synonyms(tag))
synonyms = r_serv_tags.smembers('synonym_tag_' + tag)
# synonyms to display
for synonym in synonyms:
str_synonyms = str_synonyms + synonym + ', '
# add real tag
if str_synonyms != ' - synonyms: ':
list_tags.append({'name':tag + str_synonyms,'id':tag})
else:
list_tags.append({'name':tag,'id':tag})
return jsonify(list_tags) return jsonify(list_tags)
@ -134,7 +137,6 @@ def get_tags_taxonomie():
if taxonomie in active_taxonomie: if taxonomie in active_taxonomie:
list_tags = [] list_tags = []
#l_tags = taxonomies.get(taxonomie).machinetags()
l_tags = r_serv_tags.smembers('active_tag_' + taxonomie) l_tags = r_serv_tags.smembers('active_tag_' + taxonomie)
for tag in l_tags: for tag in l_tags:
list_tags.append( tag ) list_tags.append( tag )
@ -159,15 +161,7 @@ def get_tags_galaxy():
list_tags = [] list_tags = []
l_tags = r_serv_tags.smembers('active_tag_galaxies_' + galaxy) l_tags = r_serv_tags.smembers('active_tag_galaxies_' + galaxy)
for tag in l_tags: for tag in l_tags:
synonyms = r_serv_tags.smembers('synonym_tag_' + tag) list_tags.append(get_tags_with_synonyms(tag))
str_synonyms = ' - synonyms: '
for synonym in synonyms:
str_synonyms = str_synonyms + synonym + ', '
# add real tag
if str_synonyms != ' - synonyms: ':
list_tags.append({'name':tag + str_synonyms,'id':tag})
else:
list_tags.append({'name':tag,'id':tag})
return jsonify(list_tags) return jsonify(list_tags)
@ -601,9 +595,6 @@ def edit_galaxy():
for data in val: for data in val:
try: try:
meta = data['meta'] meta = data['meta']
'''synonyms = meta['synonyms']
logo = meta['logo']
refs = meta['refs']'''
except KeyError: except KeyError:
meta = [] meta = []
tag_name = data['value'] tag_name = data['value']