delettion
This commit is contained in:
parent
45393ec97d
commit
f159ac9454
@ -1,3 +0,0 @@
|
|||||||
listservs = {'url': 'http://0.0.0.0:5555', 'lists_to_serve': []}
|
|
||||||
archives = "/Users/gauthiier/DDDDDDD/D/__projects/MAILINGLISTSARCHIVES"
|
|
||||||
selection = "selection/"
|
|
||||||
@ -8,6 +8,7 @@ sel_dump = os.path.join(config.selection, "tm-selection-dump.js")
|
|||||||
|
|
||||||
LL = Lock()
|
LL = Lock()
|
||||||
|
|
||||||
|
# TAGS
|
||||||
def update(tag, newtag, newdesc):
|
def update(tag, newtag, newdesc):
|
||||||
with LL:
|
with LL:
|
||||||
d = load_selection()
|
d = load_selection()
|
||||||
@ -65,6 +66,30 @@ def new(tag, desc):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# URL
|
||||||
|
def delete_url(tag, url):
|
||||||
|
with LL:
|
||||||
|
d = load_selection()
|
||||||
|
if tag not in list(d.keys()):
|
||||||
|
return False
|
||||||
|
|
||||||
|
for m in d[tag]['lists']:
|
||||||
|
if m['url'] == url:
|
||||||
|
d[tag]['lists'].remove(m)
|
||||||
|
break
|
||||||
|
write_selection(d)
|
||||||
|
|
||||||
|
sd = load_selection_dump()
|
||||||
|
if not tag in list(sd.keys()):
|
||||||
|
logging.warning("possible inconsistency between sel and sel_dump...")
|
||||||
|
else:
|
||||||
|
for m in sd[tag]['lists']:
|
||||||
|
if recursive_delete(m, sd[tag]['lists'], url):
|
||||||
|
break
|
||||||
|
write_selection_dump(sd)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def load_selection():
|
def load_selection():
|
||||||
with open(sel, encoding='utf-8') as f:
|
with open(sel, encoding='utf-8') as f:
|
||||||
@ -122,6 +147,18 @@ def recursive_find(msg, li, url):
|
|||||||
return msg # <-- parent thread
|
return msg # <-- parent thread
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def recursive_delete(msg, parent_list, url):
|
||||||
|
if msg['url'] == url:
|
||||||
|
parent_list.remove(msg)
|
||||||
|
return True
|
||||||
|
d = False
|
||||||
|
if 'follow-up' in list(msg.keys()):
|
||||||
|
for m in msg['follow-up']:
|
||||||
|
d = d | recursive_delete(m, msg['follow-up'], url)
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def find(li, url):
|
def find(li, url):
|
||||||
|
|
||||||
d = os.path.join(config.archives, li)
|
d = os.path.join(config.archives, li)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,19 +1,15 @@
|
|||||||
{
|
{
|
||||||
"net.art": {
|
"end2end": {
|
||||||
"desc": "...",
|
"lists": [],
|
||||||
"lists": [
|
"desc": "..."
|
||||||
{
|
|
||||||
"list": "crumb",
|
|
||||||
"url": "https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1310&L=new-media-curating&F=&S=&P=2942"
|
|
||||||
},
|
},
|
||||||
|
"net.art": {
|
||||||
|
"lists": [
|
||||||
{
|
{
|
||||||
"list": "crumb",
|
"list": "crumb",
|
||||||
"url": "https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1207&L=new-media-curating&F=&S=&P=1869"
|
"url": "https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1207&L=new-media-curating&F=&S=&P=1869"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
},
|
"desc": "..."
|
||||||
"end2end": {
|
|
||||||
"desc": "...",
|
|
||||||
"lists": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,6 +48,11 @@ def tags_w_lists():
|
|||||||
if a == "dump":
|
if a == "dump":
|
||||||
if sel.commit_from_selection():
|
if sel.commit_from_selection():
|
||||||
return "done"
|
return "done"
|
||||||
|
if a == "delete":
|
||||||
|
if sel.delete_url(data.get('tag'), data.get('url')):
|
||||||
|
return "ok"
|
||||||
|
return "-"
|
||||||
|
|
||||||
|
|
||||||
@app.route('/report')
|
@app.route('/report')
|
||||||
def report():
|
def report():
|
||||||
|
|||||||
@ -36,3 +36,7 @@ bb {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li button {
|
||||||
|
margin-top: 0em;
|
||||||
|
}
|
||||||
|
|||||||
@ -17,6 +17,15 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.del').click(function(e) {
|
||||||
|
var li = $(this).parent("li");
|
||||||
|
$.post('/tags_w_lists', {'action': 'delete', 'tag': li.data("tag"), 'url': li.data("url")}, function(d) {
|
||||||
|
if(d === 'ok') {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('#new').click(function(e) {
|
$('#new').click(function(e) {
|
||||||
var v = $(this).text();
|
var v = $(this).text();
|
||||||
console.log(v)
|
console.log(v)
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<lists>
|
<lists>
|
||||||
<ul>
|
<ul>
|
||||||
{% for h in v.lists %}
|
{% for h in v.lists %}
|
||||||
<li><a href="{{h.url}}" target="_blank">{{h.subject}}</a> -- <i>{{h.author_name}}</i></li>
|
<li data-tag="{{v.tag}}" data-url="{{h.url}}"><a href="{{h.url}}" target="_blank">{{h.subject}}</a> -- <i>{{h.author_name}}</i> <button class="del">del</button></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</lists>
|
</lists>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user