# HG changeset patch # User Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com> # Date 1295631841 -3600 # Node ID 3823611919ef181fde750f9b53fb658aa5a42c74 # Parent 8003bcd8d9a23b8c523c4a0a2e209b1ad594c3c7 set polemics as list diff -r 8003bcd8d9a2 -r 3823611919ef .hgignore --- a/.hgignore Fri Jan 21 18:03:19 2011 +0100 +++ b/.hgignore Fri Jan 21 18:44:01 2011 +0100 @@ -14,3 +14,6 @@ syntax: regexp ^script/stream/test_record\.db$ .oauth_token$ + +syntax: regexp +log.txt$ \ No newline at end of file diff -r 8003bcd8d9a2 -r 3823611919ef script/lib/iri_tweet/export_twitter_alchemy.py --- a/script/lib/iri_tweet/export_twitter_alchemy.py Fri Jan 21 18:03:19 2011 +0100 +++ b/script/lib/iri_tweet/export_twitter_alchemy.py Fri Jan 21 18:44:01 2011 +0100 @@ -205,14 +205,18 @@ meta_element = etree.SubElement(element, u'meta') - m = re.search("(\+\+|\-\-|\?\?|\=\=)",tw.text) - if m: + polemics_element = etree.Element(u'polemics') + polemic_added = False + for m in re.finditer("(\+\+|\-\-|\?\?|\=\=)",tw.text): + polemic_added = True pol_link = { '++' : u'OK', '--' : u'KO', '??' : u'Q', '==' : u'REF'}[m.group(1)] - etree.SubElement(meta_element, u'polemic').text = pol_link + etree.SubElement(polemics_element, u'polemic').text = pol_link + if polemic_added: + meta_element.append(polemics_element) etree.SubElement(meta_element, u"twitter").text = etree.CDATA(unicode(tw.original_json))