Skip to content

Commit

Permalink
[#252] Removed all xml:lang attributes except default from XML
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed May 1, 2014
1 parent bfae355 commit ffb6cdc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions akvo/scripts/cordaid/cordaid_project_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class HttpNoContent(HttpResponse):
def post_an_activity(activity_element, user):
try:
iati_id = activity_element.findall('iati-identifier')[0].text

# Remove all xml:lang attributes except the one in the iati-activity tag.
for element in activity_element.iter():
if (not element.tag == 'iati-activity') and\
('{http://www.w3.org/XML/1998/namespace}lang' in element.attrib.keys()):
del element.attrib['{http://www.w3.org/XML/1998/namespace}lang']

project = Requester(
method='post',
url_template="http://{domain}/api/{api_version}/iati_activity/"
Expand Down Expand Up @@ -70,6 +77,13 @@ def put_an_activity(activity_element, pk, url_args):
url_args.update(pk=pk)
try:
iati_id = activity_element.findall('iati-identifier')[0].text

# Remove all xml:lang attributes except the one in the iati-activity tag.
for element in activity_element.iter():
if (not element.tag == 'iati-activity') and\
('{http://www.w3.org/XML/1998/namespace}lang' in element.attrib.keys()):
del element.attrib['{http://www.w3.org/XML/1998/namespace}lang']

project = Requester(
method='put',
url_template="http://{domain}/api/{api_version}/iati_activity/{pk}/?"
Expand Down

0 comments on commit ffb6cdc

Please sign in to comment.