Mercurial > hg > index.fcgi > www > www-1
comparison myrss/myrss_app.py @ 82:d7d67887102f
move pinlib to a shared location and have pics use it
author | paulo |
---|---|
date | Wed, 29 Jun 2016 00:11:55 -0700 |
parents | d6acf8b093b7 |
children | 583400dc28a0 |
comparison
equal
deleted
inserted
replaced
8:d6b0b739bda9 | 9:49cdc4dc0890 |
---|---|
65 ns = "http://www.w3.org/2005/Atom" | 65 ns = "http://www.w3.org/2005/Atom" |
66 | 66 |
67 title = _strip_if_not_none(elementTree.find("{%s}title" % ns).text) | 67 title = _strip_if_not_none(elementTree.find("{%s}title" % ns).text) |
68 link = '' | 68 link = '' |
69 | 69 |
70 for i in elementTree.findall("{%s}link" % ns): | 70 links = elementTree.findall("{%s}link" % ns) |
71 if i.get("type") == "text/html" and i.get("rel") == "alternate": | 71 for i in links: |
72 if len(links) == 1 or i.get("rel") == "alternate": | |
72 link = i.get("href") | 73 link = i.get("href") |
73 break | 74 break |
74 | 75 |
75 items = [] | 76 items = [] |
76 | 77 |
77 for i in elementTree.findall("{%s}entry" % ns)[:MAX_ITEMS]: | 78 for i in elementTree.findall("{%s}entry" % ns)[:MAX_ITEMS]: |
78 it_title = _strip_if_not_none(i.find("{%s}title" % ns).text) | 79 it_title = _strip_if_not_none(i.find("{%s}title" % ns).text) |
79 it_link = '' | 80 it_link = '' |
80 | 81 |
81 for j in i.findall("{%s}link" % ns): | 82 it_links = i.findall("{%s}link" % ns) |
82 if j.get("type") == "text/html" and j.get("rel") == "alternate": | 83 for j in it_links: |
84 if len(it_links) == 1 or j.get("rel") == "alternate": | |
83 it_link = j.get("href") | 85 it_link = j.get("href") |
84 break | 86 break |
85 | 87 |
86 items.append((it_title, it_link)) | 88 items.append((it_title, it_link)) |
87 | 89 |