summaryrefslogtreecommitdiff
path: root/licenses/license_utils.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/license_utils.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/license_utils.py')
-rw-r--r--licenses/license_utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/licenses/license_utils.py b/licenses/license_utils.py
new file mode 100644
index 0000000..bb4479d
--- /dev/null
+++ b/licenses/license_utils.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+import re
+
+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
+