Bugfix when contacting OO; various bugfixes and improvements.

This commit is contained in:
Gaetan Delannay 2009-11-20 20:17:06 +01:00
parent cf3748bf77
commit 7435ff1601
5 changed files with 33 additions and 23 deletions

View file

@ -17,6 +17,9 @@ from descriptors import ArchetypeFieldDescriptor, ArchetypesClassDescriptor, \
COMMON_METHODS = '''
def getTool(self): return self.%s
def getProductConfig(self): return Products.%s.config
def skynView(self):
"""Redirects to skyn/view."""
return self.REQUEST.RESPONSE.redirect(self.getUrl())
'''
# ------------------------------------------------------------------------------
class Generator(AbstractGenerator):

View file

@ -37,7 +37,7 @@ class PloneInstaller:
self.ploneStuff = ploneStuff # A dict of some Plone functions or vars
self.toLog = StringIO()
self.typeAliases = {'sharing': '', 'gethtml': '',
'(Default)': 'skyn/view', 'edit': 'skyn/edit',
'(Default)': 'skynView', 'edit': 'skyn/edit',
'index.html': '', 'properties': '', 'view': ''}
self.tool = None # The Plone version of the application tool
self.appyTool = None # The Appy version of the application tool
@ -162,7 +162,7 @@ class PloneInstaller:
typeActions = typeInfo.listActions()
for action in typeActions:
if action.id == 'view':
page = 'skyn/view'
page = 'skynView'
action.edit(action='string:${object_url}/%s' % page)
elif action.id == 'edit':
page = 'skyn/edit'

View file

@ -328,7 +328,9 @@
<tr tal:define="odd repeat/items/odd;
rhComments items/comments|nothing;
state items/review_state|nothing"
tal:attributes="class python:test(odd, 'even', 'odd')" tal:condition="items/action">
tal:condition="python: items['action'] and (rhComments != '_invisible_')"
tal:attributes="class python:test(odd, 'even', 'odd')">
<td tal:content="python: tool.translate(contextObj.getWorkflowLabel(items['action']))"
tal:attributes="class string:state-${state}"/>
<td tal:define="actorid python:items.get('actor');

View file

@ -185,12 +185,9 @@ class AbstractWrapper:
self.link(fieldName, ploneObj)
self.o.reindexObject()
# Call custom initialization
try:
if externalData: param = externalData
else: param = True
appyObj.onEdit(param)
except AttributeError:
pass
if externalData: param = externalData
else: param = True
if hasattr(appyObj, 'onEdit'): appyObj.onEdit(param)
ploneObj.reindexObject()
return appyObj
@ -198,13 +195,16 @@ class AbstractWrapper:
'''Check documentation of self.o.translate.'''
return self.o.translate(label, mapping, domain)
def do(self, transition, comment='', doAction=False, doNotify=False):
def do(self, transition, comment='', doAction=False, doNotify=False,
doHistory=True):
'''This method allows to trigger on p_self a workflow p_transition
programmatically. If p_doAction is False, the action that must
normally be executed after the transition has been triggered will
not be executed. If p_doNotify is False, the notifications
(email,...) that must normally be launched after the transition has
been triggered will not be launched.'''
been triggered will not be launched. If p_doHistory is False, there
will be no trace from this transition triggering in the workflow
history.'''
wfTool = self.o.portal_workflow
availableTransitions = [t['id'] for t in \
wfTool.getTransitionsFor(self.o)]
@ -222,6 +222,12 @@ class AbstractWrapper:
# (actions, notifications) after the transition has been executed by DC
# workflow.
self.o._v_appy_do = {'doAction': doAction, 'doNotify': doNotify}
if not doHistory:
comment = '_invisible_' # Will not be displayed.
# At first sight, I wanted to remove the entry from
# self.o.workflow_history. But Plone determines the state of an
# object by consulting the target state of the last transition in
# this workflow_history.
wfTool.doActionFor(self.o, transitionName, comment=comment)
del self.o._v_appy_do