comparison roundup/rest.py @ 5646:d791c5ba5852

Python 3 compatibility encode repr when caclulating etag.
author John Rouillard <rouilj@ieee.org>
date Sun, 10 Mar 2019 19:30:03 -0400
parents b4d7588c74a4
children e8ca7072c629 ba67e397f063
comparison
equal deleted inserted replaced
5645:7f4d19867123 5646:d791c5ba5852
25 dicttoxml = None 25 dicttoxml = None
26 26
27 from roundup import hyperdb 27 from roundup import hyperdb
28 from roundup import date 28 from roundup import date
29 from roundup import actions 29 from roundup import actions
30 from roundup.anypy.strings import bs2b
30 from roundup.exceptions import * 31 from roundup.exceptions import *
31 from roundup.cgi.exceptions import * 32 from roundup.cgi.exceptions import *
32 33
33 from hashlib import md5 34 from hashlib import md5
34 35
123 124
124 classname and id are used for logging only. 125 classname and id are used for logging only.
125 ''' 126 '''
126 127
127 items = node.items(protected=True) # include every item 128 items = node.items(protected=True) # include every item
128 etag = md5(repr(items)).hexdigest() 129 etag = md5(bs2b(repr(items))).hexdigest()
129 logger.debug("object=%s%s; tag=%s; repr=%s", classname, id, 130 logger.debug("object=%s%s; tag=%s; repr=%s", classname, id,
130 etag, repr(node.items(protected=True))) 131 etag, repr(node.items(protected=True)))
131 return etag 132 return etag
132 133
133 def check_etag (node, etags, classname="Missing", id="0"): 134 def check_etag (node, etags, classname="Missing", id="0"):

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