summaryrefslogtreecommitdiff
path: root/licenses/03-cleanup-cc-html-files.py
diff options
context:
space:
mode:
authorFernando Farfan <ffarfan@gmail.com>2015-08-06 11:24:15 -0600
committerFernando Farfan <ffarfan@gmail.com>2015-08-10 15:41:10 -0600
commitb5e7930a91e5ad9fa045a8ecba71187cb0f1f3b9 (patch)
tree5c883ce50d172b971f6ea813e8641cccfd298f1c /licenses/03-cleanup-cc-html-files.py
parentacff3ca1094609e01e994fc867d75970ef046940 (diff)
Added a Utility file for license processing
We create license_utils, a utility library to include common methods to handle license files. The script that handles the cleanup of CreativeCommons files now uses the methods that have been extracted into the license_utils lib. [endlessm/eos-sdk#3471]
Diffstat (limited to 'licenses/03-cleanup-cc-html-files.py')
-rwxr-xr-xlicenses/03-cleanup-cc-html-files.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/licenses/03-cleanup-cc-html-files.py b/licenses/03-cleanup-cc-html-files.py
index 80f93cd..c81ca7d 100755
--- a/licenses/03-cleanup-cc-html-files.py
+++ b/licenses/03-cleanup-cc-html-files.py
@@ -5,6 +5,8 @@ import os
import re
import sys
+from license_utils import rewrite_attr
+
def main(argv):
langs = ['C', 'ar', 'es', 'fr', 'pt_BR']
@@ -118,12 +120,6 @@ def cleanup_deed_file(src_dir, license, lang):
f.write(html)
f.close()
-def rewrite_attr(html, elem, attr, source, target):
- for element in html.findAll(elem):
- if element.has_key(attr):
- attr_val = re.sub(source, target, element[attr])
- element[attr] = attr_val
-
def cleanup_conditional_comments(html):
comments = html.findAll(text=lambda text:isinstance(text, Comment) and '[if' in text)
for comment in comments: