Network
This commit is contained in:
parent
dd6d67cf6b
commit
036b549e75
@ -26,5 +26,4 @@ dependencies:
|
||||
- jinja2==2.10.3
|
||||
- markupsafe==1.1.1
|
||||
- werkzeug==0.16.0
|
||||
prefix: /Users/gauthiier/ZzZzzZ/D/_systems/miniconda/envs/digest
|
||||
|
||||
|
||||
9
erratum/notes.txt
Normal file
9
erratum/notes.txt
Normal file
@ -0,0 +1,9 @@
|
||||
- Ch. 3.Network
|
||||
+ numbering starting at page 179 reverts back to 15.0..
|
||||
+ layout is not consistent (ex. p.177)
|
||||
+ end of words in title
|
||||
+ 15.0-p.179 Unsubscri
|
||||
+ 16.0-p.179 tex
|
||||
+ 22.29 -- empty...
|
||||
+ email address in from -- 25.2 auskadi {AT} tvcabo.co.mz
|
||||
+ text formating -- 19.0 p.182
|
||||
@ -26,10 +26,21 @@ def read_xml(d, fn):
|
||||
subject_str = m.find('subject').text
|
||||
xml_data.append({'nbr': nbr_str, 'date': date_str, 'from': from_str, 'subject': subject_str})
|
||||
|
||||
# sort
|
||||
xml_data[:] = sorted(xml_data, key=lambda x: parse_nbr_xml(x['nbr']))
|
||||
return xml_data
|
||||
|
||||
|
||||
def update_nbr_xml(d, fn, nbr, new_nbr):
|
||||
def parse_nbr_xml(nbr_str):
|
||||
if '-' in nbr_str:
|
||||
nbr_str = nbr_str.split('-')[0]
|
||||
# split number and return a tuple
|
||||
# ex. 15.4 -> (15, 4)
|
||||
tok = nbr_str.split('.')
|
||||
tup = (int(tok[0]), int(tok[1]))
|
||||
return tup
|
||||
|
||||
def update_nbr_xml(d, fn, nbr, new_nbr, date):
|
||||
fp = os.path.join(d, fn)
|
||||
if not os.path.isfile(fp):
|
||||
return False
|
||||
@ -37,24 +48,54 @@ def update_nbr_xml(d, fn, nbr, new_nbr):
|
||||
tr = et.parse(fp)
|
||||
m = tr.xpath(".//nbr[text()='" + nbr + "']")
|
||||
|
||||
if m is None or len(m) > 1:
|
||||
if m is None:
|
||||
return False
|
||||
|
||||
mm = None
|
||||
for k in m:
|
||||
if k.getparent().find('date').text == date:
|
||||
mm = k
|
||||
break
|
||||
|
||||
if mm is None:
|
||||
return False
|
||||
|
||||
# replace nbr
|
||||
m[0].text = new_nbr
|
||||
mm.text = new_nbr
|
||||
|
||||
# order all mails according to their nbr
|
||||
mails = tr.find('mails')
|
||||
print(mails)
|
||||
|
||||
mails[:] = sorted(mails, key=lambda x: float(x.find('nbr').text))
|
||||
mails[:] = sorted(mails, key=lambda x: parse_nbr_xml(x.find('nbr').text))
|
||||
|
||||
tr.write(fp)
|
||||
return True
|
||||
|
||||
|
||||
def delete_nbr_xml(d, fn, nbr, date):
|
||||
fp = os.path.join(d, fn)
|
||||
if not os.path.isfile(fp):
|
||||
return False
|
||||
|
||||
tr = et.parse(fp)
|
||||
m = tr.xpath(".//nbr[text()='" + nbr + "']")
|
||||
|
||||
if m is None:
|
||||
return False
|
||||
|
||||
mm = None
|
||||
for k in m:
|
||||
if k.getparent().find('date').text == date:
|
||||
mm = k
|
||||
break
|
||||
|
||||
if mm is None:
|
||||
return False
|
||||
|
||||
mail = mm.getparent()
|
||||
mail.getparent().remove(mail)
|
||||
|
||||
tr.write(fp)
|
||||
return True
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@ -78,11 +119,14 @@ def xmlfn(fn):
|
||||
return "File: " + fn + "does not exist."
|
||||
elif request.method == 'POST':
|
||||
data = request.form
|
||||
print(data)
|
||||
a = data.get('action')
|
||||
if a == "update":
|
||||
logging.info("POST update for " + fn + " -- " + data.get('nbr') + " ++ " + data.get('new_nbr'))
|
||||
if update_nbr_xml(config.xml['path'], fn, data.get('nbr'), data.get('new_nbr')):
|
||||
logging.info("POST UPDATE " + fn + " -- " + data.get('nbr') + " ++ " + data.get('new_nbr'))
|
||||
if update_nbr_xml(config.xml['path'], fn, data.get('nbr'), data.get('new_nbr'), data.get('date')):
|
||||
return "ok"
|
||||
elif a == "delete":
|
||||
logging.info("POST DELETE " + fn + " -- " + data.get('nbr'))
|
||||
if delete_nbr_xml(config.xml['path'], fn, data.get('nbr'), data.get('date')):
|
||||
return "ok"
|
||||
return "-"
|
||||
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
$(document).ready(function(){
|
||||
$('.nbr_input').submit(function(e) { return false; });
|
||||
$('.update').click(function(e) {
|
||||
$('.update, .delete').click(function(e) {
|
||||
console.log("blabla");
|
||||
var li = $(this).parent("li");
|
||||
$.post('/xml/' + li.data("file"), {'action': 'update', 'nbr': li.data("nbr"), 'new_nbr': li.children(".nbr_input").val()}, function(d) {
|
||||
console.log($(this).attr('class'));
|
||||
$.post('/xml/' + li.data("file"), {'action': $(this).attr('class'), 'nbr': li.data("nbr"), 'new_nbr': li.children(".nbr_input").val(), 'date': li.data("date")}, function(d) {
|
||||
if(d === 'ok') {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<ul>
|
||||
<!-- {'nbr': nbr_str, 'date': date_str, 'from': from_str, 'subject': subject_str} -->
|
||||
{% for d in data %}
|
||||
<li data-file={{fn}} data-nbr="{{d.nbr}}" data-date={{d.date}}><input type="text" class="nbr_input" value="{{d.nbr}}"> - {{d.from}} - {{d.subject}} - {{d.date}}<button class="update">+</button></li>
|
||||
<li data-file="{{fn}}" data-nbr="{{d.nbr}}" data-date="{{d.date}}"><input type="text" class="nbr_input" value="{{d.nbr}}"> - {{d.from}} - {{d.subject}} - {{d.date}}<button class="update">+</button><button class="delete">-</button></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -719,57 +719,5 @@ Inke Arns, Andreas Broeckmann
|
||||
|
||||
Berlin, November 2001</content>
|
||||
</mail>
|
||||
<mail>
|
||||
<nbr>7.1</nbr>
|
||||
<subject>[spectre] Rise and Decline of the Syndicate-SOME THOUGHTS</subject>
|
||||
<from>KINGA ARAYA</from>
|
||||
<to>spectre@mikrolisten.de</to>
|
||||
<date>Tue, 13 Nov 2001 15:35:42 -0500 (EST)</date>
|
||||
<content>Dear Inke and Andreas,
|
||||
|
||||
I have been a rather 'silent' member on your ex-Syndicate list. After the
|
||||
unpleasant events with Miss nn et al., I abandoned the Syndicate list and
|
||||
I gladly joined the Spectre list you created. I do appreciate time you
|
||||
took in writing to all of us about the summer events on the old Syndicate
|
||||
list. I actually did not have a clear idea what was really going on except
|
||||
that I was sensing that SOMETHING was going wrong with the virtual
|
||||
community you created. I did not know who the nn-crowd was and what they
|
||||
really wanted.
|
||||
|
||||
Even though I was not a very active member of the Syndicate, I always
|
||||
appreciated the pieces of information you provided. THANK YOU VERY MUCH TO
|
||||
ANDREAS and INKE FOR YOUR WORK. And since I am an artist and a doctoral
|
||||
student who is always 'on the run', I regret that fact that when nn
|
||||
abusive e-mails where polluting my e-mail box I was simply deleting them
|
||||
and kept going on with my busy life in-between languages, countries and
|
||||
cultures. (I do not live on internet).
|
||||
|
||||
Your e-mail Inke MADE ME understand that the silence of the members is no
|
||||
longer possible. Yes, we DO have certain responsibilities to each other,
|
||||
we-virtual and invisible specters. I think that your e-mail touches on a
|
||||
very critical issue of ethical and aesthetic responsibilities of virtual
|
||||
e-mails that have never been dealt successfully (at least to my
|
||||
knowledge).
|
||||
|
||||
Well, now when I finally CAME OUT what would be my/our next step?
|
||||
|
||||
I believe that all the Spectre subscribes share certain responsibilities
|
||||
to each others (it is already voiced in Inke's mail) and I am not sure
|
||||
what to propose given the large number of member of Specters. We cannot
|
||||
send each others personal e-mails and start interdicting each other - it
|
||||
would create a virtual chaos! But I strongly believe that we have to DO
|
||||
something. As a flamboyant artist I would say: "Hey, who/where are you?
|
||||
Let's go for a drink and talk about art!" Unfortunately it can only remain
|
||||
a rhetoric call. The only thing I CAN do right now is to VOICE my virtual
|
||||
presence more often on the Specter's list because I have great respect to
|
||||
people who work very hard to make sure that we get important and wonderful
|
||||
information about our cultural and political status quo.
|
||||
|
||||
Thank you and best wishes to Inke, Andreas and all the 250 (+) member of
|
||||
the Specter,
|
||||
|
||||
Kinga Araya (an interdisciplinary artist currently working and studying in
|
||||
Montreal, Canada)</content>
|
||||
</mail>
|
||||
</mails>
|
||||
</chapter>
|
||||
11657
xml/3.Network.xml
11657
xml/3.Network.xml
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user