Commit dcaffa0b authored by Arnaud Fontaine's avatar Arnaud Fontaine

WIP

parent ca2febe1
......@@ -72,6 +72,7 @@ def manage_addERP5SiteForm(*args, **kw):
default_sql_connection_string = 'test test'
import pdb
# ERP5Site Constructor
def manage_addERP5Site(self,
id,
......@@ -96,30 +97,33 @@ def manage_addERP5Site(self,
'''
Adds a portal instance.
'''
gen = ERP5Generator()
id = str(id).strip()
p = gen.create(self,
id,
create_userfolder,
erp5_catalog_storage,
erp5_sql_connection_string,
cmf_activity_sql_connection_string,
bt5_repository_url,
bt5,
id_store_interval,
cloudooo_url,
create_activities=create_activities,
light_install=light_install,
reindex=reindex,
sql_reset=sql_reset)
gen.setupDefaultProperties(p,
title,
description,
email_from_address,
email_from_name,
validate_email)
if RESPONSE is not None:
RESPONSE.redirect(p.absolute_url())
try:
gen = ERP5Generator()
id = str(id).strip()
p = gen.create(self,
id,
create_userfolder,
erp5_catalog_storage,
erp5_sql_connection_string,
cmf_activity_sql_connection_string,
bt5_repository_url,
bt5,
id_store_interval,
cloudooo_url,
create_activities=create_activities,
light_install=light_install,
reindex=reindex,
sql_reset=sql_reset)
gen.setupDefaultProperties(p,
title,
description,
email_from_address,
email_from_name,
validate_email)
if RESPONSE is not None:
RESPONSE.redirect(p.absolute_url())
except:
pdb.post_mortem()
def getCatalogStorageList(*args, **kw):
"""
......@@ -2518,6 +2522,8 @@ def initialize(self):
'MySQL error while trying to create ERP5 site. Retrying...',
error=1)
time.sleep(5)
except:
import pdb; pdb.post_mortem()
from Products.TimerService.timerserver.TimerServer import TimerRequest
def traverse(*args, **kw):
del TimerRequest.traverse
......
......@@ -217,7 +217,7 @@ def runwsgi():
else:
SignalHandler.registerHandler(signal.SIGTERM, sys.exit)
if args.timerserver_interval:
if args.timerserver_interval and False:
import Products.TimerService
Products.TimerService.timerserver.TimerServer.TimerServer(
module='Zope2',
......
......@@ -476,7 +476,11 @@ def synchronizeDynamicModules(context, force=False):
migrate = True
else:
continue
tool._bootstrap()
try:
tool._bootstrap()
except Exception as e:
import pdb; pdb.post_mortem()
raise
tool.__class__ = getattr(erp5.portal_type, tool.portal_type)
# TODO: Create portal_activities here, and even before portal_types:
# - all code in ActiveObject could assume that it always exists
......
......@@ -60,7 +60,7 @@ def convert(S):
### [\x00-\x1f] characters will be escaped to make a more
### readable output.
try:
if not isinstance(S, str):
if isinstance(S, bytes):
S.decode('utf8')
except UnicodeDecodeError:
return 'base64', base64.encodestring(S)[:-1]
......@@ -328,7 +328,8 @@ class NoBlanks(object):
"""
# Ignore element data between elements (eg '<e> <f> </f> </e>')...
if data.strip():
if isinstance(data, str):
if isinstance(data, bytes):
import pdb; pdb.set_trace()
data = data.encode('raw_unicode_escape')
self.append(data)
......@@ -352,7 +353,8 @@ class NoBlanks(object):
self.previous_discarded_data = None
self.previous_stack_end = None
if isinstance(data, str):
if isinstance(data, bytes):
import pdb; pdb.set_trace()
data = data.encode('raw_unicode_escape')
self.append(data)
......@@ -610,6 +612,7 @@ class ToXMLUnpickler(Unpickler):
dispatch[OBJ] = load_obj
def load_global(self):
# import pdb; pdb.set_trace()
module = self.readline()[:-1]
name = self.readline()[:-1]
self.append(Global(module, name, self.id_mapping))
......@@ -681,9 +684,17 @@ def save_string(self, tag, data):
if l < 256:
if isinstance(v, str):
import pdb; pdb.set_trace()
v = SHORT_BINSTRING + bytes([l]) + v
if encoding == 'base64':
op = SHORT_BINBYTES
else:
op = SHORT_BINSTRING
v = op + bytes([l]) + v
else:
v = BINSTRING + struct.pack('<i', l) + v
if encoding == 'base64':
op = BINBYTES
else:
op = BINSTRING
v = op + struct.pack('<i', l) + v
else:
v = STRING + repr(v) + '\n'
return save_put(self, v, a)
......@@ -758,6 +769,7 @@ class xmlPickler(NoBlanks, xyap):
if tag in end:
top = end[tag](self, tag, top)
if isinstance(top, str):
import pdb; pdb.set_trace()
top = top.encode('raw_unicode_escape')
append(top)
......@@ -804,6 +816,10 @@ def importXML(jar, file, clue=''):
if type(file) is str:
file=open(file, 'rb')
outfile=TemporaryFile()
# def write(*args, **kwargs):
# import pdb; pdb.set_trace()
# return TemporaryFile.write(*args, **kwargs)
# outfile.write = write
data=file.read()
F=xmlPickler()
F.end_handlers['record'] = save_record
......
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