# HG changeset patch # User RĂ©mi Cardona # Date 1444748229 -7200 # Node ID e08102f45237b992c84aaa53fb9a7332276123b0 # Parent 96380c1524b06f6877e40a644a12f4d0aebb1711 [py3k] bytes required for hashlib.{md5,sha1}() diff -r 96380c1524b0 -r e08102f45237 cwconfig.py --- a/cwconfig.py Thu Oct 01 11:40:23 2015 +0200 +++ b/cwconfig.py Tue Oct 13 16:57:09 2015 +0200 @@ -1110,7 +1110,7 @@ version = self.cube_version(pkg) infos.append('%s-%s' % (pkg, version)) infos.append('cubicweb-%s' % str(self.cubicweb_version())) - return md5(';'.join(infos)).hexdigest() + return md5((';'.join(infos)).encode('ascii')).hexdigest() def load_configuration(self, **kw): """load instance's configuration files""" diff -r 96380c1524b0 -r e08102f45237 devtools/__init__.py --- a/devtools/__init__.py Thu Oct 01 11:40:23 2015 +0200 +++ b/devtools/__init__.py Tue Oct 13 16:57:09 2015 +0200 @@ -679,7 +679,7 @@ @property def _config_id(self): - return sha1(self.config.apphome).hexdigest()[:10] + return sha1(self.config.apphome.encode('utf-8')).hexdigest()[:10] def _backup_name(self, db_id): # merge me with parent backup_name = '_'.join(('cache', self._config_id, self.dbname, db_id)) diff -r 96380c1524b0 -r e08102f45237 entities/adapters.py --- a/entities/adapters.py Thu Oct 01 11:40:23 2015 +0200 +++ b/entities/adapters.py Tue Oct 13 16:57:09 2015 +0200 @@ -386,7 +386,7 @@ for rschema, attrschema in eschema.attribute_definitions(): rdef = rschema.rdef(eschema, attrschema) for constraint in rdef.constraints: - if cstrname == 'cstr' + md5(eschema.type + rschema.type + constraint.type() + (constraint.serialize() or '')).hexdigest(): + if cstrname == 'cstr' + md5((eschema.type + rschema.type + constraint.type() + (constraint.serialize() or '')).encode('ascii')).hexdigest(): break else: continue diff -r 96380c1524b0 -r e08102f45237 hooks/syncschema.py --- a/hooks/syncschema.py Thu Oct 01 11:40:23 2015 +0200 +++ b/hooks/syncschema.py Tue Oct 13 16:57:09 2015 +0200 @@ -769,8 +769,8 @@ self.unique_changed = True if cstrtype in ('BoundaryConstraint', 'IntervalBoundConstraint', 'StaticVocabularyConstraint'): if oldcstr is not None: - oldcstrname = 'cstr' + md5(rdef.subject.type + rdef.rtype.type + cstrtype + - (self.oldcstr.serialize() or '')).hexdigest() + oldcstrname = 'cstr' + md5((rdef.subject.type + rdef.rtype.type + cstrtype + + (self.oldcstr.serialize() or '')).encode('ascii')).hexdigest() cnx.system_sql('ALTER TABLE %s%s DROP CONSTRAINT %s' % (SQL_PREFIX, rdef.subject.type, oldcstrname)) cstrname, check = y2sql.check_constraint(rdef.subject, rdef.object, rdef.rtype.type, diff -r 96380c1524b0 -r e08102f45237 server/schema2sql.py --- a/server/schema2sql.py Thu Oct 01 11:40:23 2015 +0200 +++ b/server/schema2sql.py Tue Oct 13 16:57:09 2015 +0200 @@ -162,8 +162,8 @@ def check_constraint(eschema, aschema, attr, constraint, dbhelper, prefix=''): # XXX should find a better name - cstrname = 'cstr' + md5(eschema.type + attr + constraint.type() + - (constraint.serialize() or '')).hexdigest() + cstrname = 'cstr' + md5((eschema.type + attr + constraint.type() + + (constraint.serialize() or '')).encode('ascii')).hexdigest() if constraint.type() == 'BoundaryConstraint': value = as_sql(constraint.boundary, dbhelper, prefix) return cstrname, '%s%s %s %s' % (prefix, attr, constraint.operator, value) diff -r 96380c1524b0 -r e08102f45237 web/request.py --- a/web/request.py Thu Oct 01 11:40:23 2015 +0200 +++ b/web/request.py Tue Oct 13 16:57:09 2015 +0200 @@ -52,7 +52,7 @@ _MARKER = object() def build_cb_uid(seed): - sha = sha1('%s%s%s' % (time.time(), seed, random.random())) + sha = sha1(('%s%s%s' % (time.time(), seed, random.random())).encode('ascii')) return 'cb_%s' % (sha.hexdigest()) diff -r 96380c1524b0 -r e08102f45237 web/views/staticcontrollers.py --- a/web/views/staticcontrollers.py Thu Oct 01 11:40:23 2015 +0200 +++ b/web/views/staticcontrollers.py Tue Oct 13 16:57:09 2015 +0200 @@ -140,7 +140,7 @@ """return the filepath that will be used to cache concatenation of `paths` """ _, ext = osp.splitext(paths[0]) - fname = 'cache_concat_' + hashlib.md5(';'.join(paths)).hexdigest() + ext + fname = 'cache_concat_' + hashlib.md5((';'.join(paths)).encode('ascii')).hexdigest() + ext return osp.join(self.config.appdatahome, 'uicache', fname) def concat_cached_filepath(self, paths):