[schema2sql] encode string before passing it to md5

py3k only accepts a byte array here. Related to #267910.

authorJulien Cristau <julien.cristau@logilab.fr>
changeset87f70abdbc8c
branchdefault
phasepublic
hiddenno
parent revision#c5d912ca54aa [debian] addition of computed attributes/relations breaks older cubicweb
child revision#1eba2a7d0f1d [reader] don't use 3-expr raise syntax
files modified by this revision
schema2sql.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1413463184 -7200
# Thu Oct 16 14:39:44 2014 +0200
# Node ID 87f70abdbc8c429e490b5c274bc58f773781c421
# Parent c5d912ca54aa337af35989fe7a55333b5a1df52e
[schema2sql] encode string before passing it to md5

py3k only accepts a byte array here. Related to #267910.

diff --git a/schema2sql.py b/schema2sql.py
@@ -75,13 +75,13 @@
1                for rschema in eschema.subject_relations()
2                if not rschema.final and rschema.inlined]
3      return attrs
4 
5  def unique_index_name(eschema, columns):
6 -    return u'unique_%s' % md5(eschema.type +
7 +    return u'unique_%s' % md5((eschema.type +
8                                ',' +
9 -                              ','.join(sorted(columns))).hexdigest()
10 +                              ','.join(sorted(columns))).encode('ascii')).hexdigest()
11 
12  def iter_unique_index_names(eschema):
13      for columns in eschema._unique_together or ():
14          yield columns, unique_index_name(eschema, columns)
15