Commit dcaffa0b authored by Arnaud Fontaine's avatar Arnaud Fontaine

WIP

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