Mercurial > code > home > repos > href
comparison 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 |
comparison
equal
deleted
inserted
replaced
27:3d9dc1571ade | 28:7c82ffbca5d0 |
---|---|
1 import urlparse, urllib | 1 import urllib.parse, urllib.request, urllib.parse, urllib.error |
2 from dateutil.tz import tzlocal | 2 from dateutil.tz import tzlocal |
3 | 3 |
4 class NotFound(ValueError): | 4 class NotFound(ValueError): |
5 pass | 5 pass |
6 | 6 |
45 out['displayDescription'] = out['href'] | 45 out['displayDescription'] = out['href'] |
46 else: | 46 else: |
47 out['displayDescription'] = out['description'] | 47 out['displayDescription'] = out['description'] |
48 | 48 |
49 out['tagWords'] = [{'word' : w} for w in out['tag'].split(None)] | 49 out['tagWords'] = [{'word' : w} for w in out['tag'].split(None)] |
50 out['domain'] = urlparse.urlparse(out['href']).netloc | 50 out['domain'] = urllib.parse.urlparse(out['href']).netloc |
51 out['editLink'] = 'addLink?' + urllib.urlencode([('url', out['href'])]) | 51 out['editLink'] = 'addLink?' + urllib.parse.urlencode([('url', out['href'])]) |
52 out['shareWith'] = [{'label' : uri} for uri in doc.get('shareWith', [])] | 52 out['shareWith'] = [{'label' : uri} for uri in doc.get('shareWith', [])] |
53 return out | 53 return out |
54 | 54 |
55 def fromPostdata(self, data, user, t): | 55 def fromPostdata(self, data, user, t): |
56 if not user or not data.href: | 56 if not user or not data.href: |
59 user=user, | 59 user=user, |
60 description=data.description, | 60 description=data.description, |
61 extended=data.extended, | 61 extended=data.extended, |
62 href=data.href, | 62 href=data.href, |
63 private=data.private, | 63 private=data.private, |
64 shareWith=filter(None, data.shareWith.split(',')), | 64 shareWith=[_f for _f in data.shareWith.split(',') if _f], |
65 tag=data.tag, | 65 tag=data.tag, |
66 t=t, | 66 t=t, |
67 ) | 67 ) |
68 | 68 |
69 def asDeliciousAddParams(self): | 69 def asDeliciousAddParams(self): |