Mercurial > p > roundup > code
comparison roundup/rest.py @ 5808:bab86c874efb
Fix: PendingDeprecationWarning: HMAC() without an explicit digestmod
argument is deprecated. Set md5 explicitly.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 12 Jun 2019 19:52:29 -0400 |
| parents | 7ba0ee980fc7 |
| children | edd9e2c67785 |
comparison
equal
deleted
inserted
replaced
| 5807:0467d80eaeec | 5808:bab86c874efb |
|---|---|
| 26 # else look in sys.path | 26 # else look in sys.path |
| 27 from dicttoxml import dicttoxml | 27 from dicttoxml import dicttoxml |
| 28 except ImportError: | 28 except ImportError: |
| 29 # else not supported | 29 # else not supported |
| 30 dicttoxml = None | 30 dicttoxml = None |
| 31 | |
| 32 from hashlib import md5 | |
| 31 | 33 |
| 32 from roundup import hyperdb | 34 from roundup import hyperdb |
| 33 from roundup import date | 35 from roundup import date |
| 34 from roundup import actions | 36 from roundup import actions |
| 35 from roundup.i18n import _ | 37 from roundup.i18n import _ |
| 142 classname and id are used for logging only. | 144 classname and id are used for logging only. |
| 143 ''' | 145 ''' |
| 144 | 146 |
| 145 items = node.items(protected=True) # include every item | 147 items = node.items(protected=True) # include every item |
| 146 etag = hmac.new(bs2b(key),bs2b(repr_format + | 148 etag = hmac.new(bs2b(key),bs2b(repr_format + |
| 147 repr(sorted(items)))).hexdigest() | 149 repr(sorted(items))), md5).hexdigest() |
| 148 logger.debug("object=%s%s; tag=%s; repr=%s", classname, id, | 150 logger.debug("object=%s%s; tag=%s; repr=%s", classname, id, |
| 149 etag, repr(node.items(protected=True))) | 151 etag, repr(node.items(protected=True))) |
| 150 # Quotes are part of ETag spec, normal headers don't have quotes | 152 # Quotes are part of ETag spec, normal headers don't have quotes |
| 151 return '"%s"' % etag | 153 return '"%s"' % etag |
| 152 | 154 |
