|
33 | 33 |
|
34 | 34 | # google key for sagemath.org - no longer a free one available |
35 | 35 | # this is an "api key" credential for GCP's "Geocode API" |
36 | | -gkey = open(os.path.expanduser("~/geocode.key")).read().strip() |
| 36 | +try: |
| 37 | + gkey = open(os.path.expanduser("~/geocode.key")).read().strip() |
| 38 | +except FileNotFoundError: |
| 39 | + gkey = None |
37 | 40 |
|
38 | 41 | # allowed attributes in source xml, for checkXML |
39 | 42 | goodKeys = [ |
40 | | - "name", "location", "work", "description", "url", "pix", "size", "jitter", |
| 43 | + "name", "altnames", "location", "work", "description", "url", "pix", "size", "jitter", |
41 | 44 | "trac", "github", "gitlab" |
42 | 45 | ] |
43 | 46 |
|
@@ -95,11 +98,13 @@ def writeToDevmap(): |
95 | 98 | if c.tagName != "contributor": |
96 | 99 | continue |
97 | 100 | dev = c.getAttribute("name") |
| 101 | + altnames = c.getAttribute("altnames") |
98 | 102 | loc = c.getAttribute("location") |
99 | 103 | work = c.getAttribute("work") |
100 | 104 | descr = c.getAttribute("description") |
101 | 105 | url = c.getAttribute("url") |
102 | 106 | trac = c.getAttribute("trac") |
| 107 | + github = c.getAttribute("github") |
103 | 108 |
|
104 | 109 | tr = devmap.createElement("tr") |
105 | 110 | td = devmap.createElement("td") |
@@ -134,14 +139,31 @@ def writeToDevmap(): |
134 | 139 | d_el = parseString("<span>%s</span>" % d) |
135 | 140 | td.appendChild(d_el.firstChild) |
136 | 141 |
|
137 | | - if len(trac) == 0: |
138 | | - trac = dev |
139 | | - trac = trac.replace(" ", "%20") |
140 | 142 | a = devmap.createElement("a") |
141 | | - a.setAttribute("href", tracSearch + trac) |
| 143 | + tracQuery = f"https://trac.sagemath.org/query?" |
| 144 | + main_trac = None |
| 145 | + trac_list = [t.strip() for t in trac.split(',') if t.strip()] |
| 146 | + gh_trac_list = [f'gh-{gh.strip()}' for gh in github.split(',') if gh.strip()] |
| 147 | + for trac in trac_list + gh_trac_list: |
| 148 | + if not main_trac: |
| 149 | + main_trac = trac |
| 150 | + tracQuery += f"&or&cc=~{trac}" |
| 151 | + tracQuery += f"&or&reporter=~{trac}" |
| 152 | + tracQuery += f"&or&owner=~{trac}" |
| 153 | + for name in [dev] + altnames.split(','): |
| 154 | + name = name.strip() |
| 155 | + if not name: |
| 156 | + continue |
| 157 | + tracQuery += f"&or&author=~{name}" |
| 158 | + tracQuery += f"&or&reviewer=~{name}" |
| 159 | + tracQuery += "&max=500&col=id&col=summary&col=author&col=status&col=priority&col=milestone&col=reviewer&order=priority" |
| 160 | + tracQuery = tracQuery.replace(" ", "%20") |
| 161 | + a.setAttribute("href", tracQuery) |
142 | 162 | a.setAttribute("class", "trac") |
143 | | - #a.setAttribute("target", "_blank") |
144 | | - a.appendChild(devmap.createTextNode("contributions")) |
| 163 | + if main_trac: |
| 164 | + a.appendChild(devmap.createTextNode(f"contributions (trac: {main_trac})")) |
| 165 | + else: |
| 166 | + a.appendChild(devmap.createTextNode(f"contributions (trac)")) |
145 | 167 | td.appendChild(devmap.createElement("br")) |
146 | 168 | td.appendChild(a) |
147 | 169 |
|
@@ -189,6 +211,8 @@ def getGeo(loc): |
189 | 211 | CSV Geo returns: [200,6,42.730070,-73.690570] |
190 | 212 | [retcode,accuracy,lng,lat] |
191 | 213 | """ |
| 214 | + if not gkey: |
| 215 | + return None |
192 | 216 | loc = loc.replace(" ", "+") |
193 | 217 | loc = quote(loc.encode('UTF-8')) |
194 | 218 | print(loc, ">>>", end="") |
|
0 commit comments