comparison roundup/rest.py @ 5673:6b6bc8d31caf

Merged
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 25 Mar 2019 19:47:29 +0100
parents 1e8f17090a33
children 6dc4dba1c225
comparison
equal deleted inserted replaced
5672:a7211712b110 5673:6b6bc8d31caf
130 130
131 classname and id are used for logging only. 131 classname and id are used for logging only.
132 ''' 132 '''
133 133
134 items = node.items(protected=True) # include every item 134 items = node.items(protected=True) # include every item
135 etag = md5(bs2b(repr(items))).hexdigest() 135 etag = md5(bs2b(repr(sorted(items)))).hexdigest()
136 logger.debug("object=%s%s; tag=%s; repr=%s", classname, id, 136 logger.debug("object=%s%s; tag=%s; repr=%s", classname, id,
137 etag, repr(node.items(protected=True))) 137 etag, repr(node.items(protected=True)))
138 return etag 138 return etag
139 139
140 def check_etag (node, etags, classname="Missing", id="0"): 140 def check_etag (node, etags, classname="Missing", id="0"):
1334 elif action == 'set' and 'messages' in data: 1334 elif action == 'set' and 'messages' in data:
1335 num += 1 1335 num += 1
1336 summary.setdefault(status_name, []).append(issue_object) 1336 summary.setdefault(status_name, []).append(issue_object)
1337 messages.append((num, issue_object)) 1337 messages.append((num, issue_object))
1338 1338
1339 messages.sort(reverse=True) 1339 sorted(messages, key=lambda tup: tup[0], reverse=True)
1340 1340
1341 result = { 1341 result = {
1342 'created': created, 1342 'created': created,
1343 'summary': summary, 1343 'summary': summary,
1344 'most_discussed': messages[:10] 1344 'most_discussed': messages[:10]
1448 else: 1448 else:
1449 indent = None 1449 indent = None
1450 output = RoundupJSONEncoder(indent=indent).encode(output) 1450 output = RoundupJSONEncoder(indent=indent).encode(output)
1451 elif data_type.lower() == "xml" and dicttoxml: 1451 elif data_type.lower() == "xml" and dicttoxml:
1452 self.client.setHeader("Content-Type", "application/xml") 1452 self.client.setHeader("Content-Type", "application/xml")
1453 output = dicttoxml(output, root=False) 1453 output = b2s(dicttoxml(output, root=False))
1454 else: 1454 else:
1455 self.client.response_code = 406 1455 self.client.response_code = 406
1456 output = "Content type is not accepted by client" 1456 output = "Content type is not accepted by client"
1457 1457
1458 # Make output json end in a newline to 1458 # Make output json end in a newline to

Roundup Issue Tracker: http://roundup-tracker.org/