diff link.py @ 28:7c82ffbca5d0

py3 and k8s upgrade
author drewp@bigasterisk.com
date Sun, 12 Jul 2020 13:16:33 -0700
parents d6a09e8efa56
children e86642cf7393
line wrap: on
line diff
--- a/link.py	Sat Dec 24 20:19:23 2016 -0800
+++ b/link.py	Sun Jul 12 13:16:33 2020 -0700
@@ -1,4 +1,4 @@
-import urlparse, urllib
+import urllib.parse, urllib.request, urllib.parse, urllib.error
 from dateutil.tz import tzlocal
 
 class NotFound(ValueError):
@@ -47,8 +47,8 @@
             out['displayDescription'] = out['description']
 
         out['tagWords'] = [{'word' : w} for w in out['tag'].split(None)]
-        out['domain'] = urlparse.urlparse(out['href']).netloc
-        out['editLink'] = 'addLink?' + urllib.urlencode([('url', out['href'])])
+        out['domain'] = urllib.parse.urlparse(out['href']).netloc
+        out['editLink'] = 'addLink?' + urllib.parse.urlencode([('url', out['href'])])
         out['shareWith'] = [{'label' : uri} for uri in doc.get('shareWith', [])]
         return out
 
@@ -61,7 +61,7 @@
             extended=data.extended,
             href=data.href,
             private=data.private,
-            shareWith=filter(None, data.shareWith.split(',')),
+            shareWith=[_f for _f in data.shareWith.split(',') if _f],
             tag=data.tag,
             t=t,
         )