Commit 6c60d2f5 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeTestCase: review usage of erp5_site_global_id

This needs to be set on portal_memcached, because it's no longer acquired
since 4889d523 (Define property's default value at class level., 2012-12-31)

Use a hash to get a shorter value, because memcached keys are limited
in size and a base64 of connection string was more than 70 characters.

Fix the data type for python3, this is expected to be str, not bytes.

XXX I feel setting on portal_memcached like this is wrong, I don't
understand 4889d523 and it seems to me that we should revert that
change now and let erp5_site_global_id be acquired from the ERP5 Site.
portal_caches also uses erp5_site_global_id and it acquires it.
parent 8cc780c1
......@@ -7,8 +7,8 @@
__version__ = '0.3.0'
import base64
import errno
import hashlib
import httplib
import os
import random
......@@ -1274,8 +1274,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
**kw)
sql = kw.get('erp5_sql_connection_string')
if sql:
app[portal_name]._setProperty('erp5_site_global_id',
base64.standard_b64encode(str2bytes(sql)))
erp5_site_global_id = hashlib.md5(str2bytes(sql)).hexdigest()[:8]
app[portal_name]._setProperty('erp5_site_global_id', erp5_site_global_id)
app[portal_name].portal_memcached.erp5_site_global_id = erp5_site_global_id
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start))
# Release locks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment