Minor bugfixes.
This commit is contained in:
parent
2ecd2d7ef1
commit
500637eb53
|
@ -1,5 +1,6 @@
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
import re, time
|
import re, time
|
||||||
|
from appy.shared.utils import Traceback
|
||||||
from appy.gen.utils import sequenceTypes, PageDescr
|
from appy.gen.utils import sequenceTypes, PageDescr
|
||||||
from appy.shared.data import countries
|
from appy.shared.data import countries
|
||||||
|
|
||||||
|
@ -436,7 +437,8 @@ class Action(Type):
|
||||||
# anything), we consider the action as successfull.
|
# anything), we consider the action as successfull.
|
||||||
if res[0] == None: res[0] = True
|
if res[0] == None: res[0] = True
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
res = (False, str(e))
|
res = (False, 'An error occurred. %s' % str(e))
|
||||||
|
obj.log(Traceback.get(), type='error')
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class Info(Type):
|
class Info(Type):
|
||||||
|
|
|
@ -162,6 +162,8 @@ class Generator(AbstractGenerator):
|
||||||
self.copyFile('Portlet.pt', self.repls,
|
self.copyFile('Portlet.pt', self.repls,
|
||||||
destName='%s.pt' % self.portletName, destFolder=self.skinsFolder)
|
destName='%s.pt' % self.portletName, destFolder=self.skinsFolder)
|
||||||
self.copyFile('tool.gif', {})
|
self.copyFile('tool.gif', {})
|
||||||
|
self.copyFile(
|
||||||
|
'global_statusmessage.pt', {}, destFolder=self.skinsFolder)
|
||||||
self.copyFile('Styles.css.dtml',self.repls, destFolder=self.skinsFolder,
|
self.copyFile('Styles.css.dtml',self.repls, destFolder=self.skinsFolder,
|
||||||
destName = '%s.css.dtml' % self.applicationName)
|
destName = '%s.css.dtml' % self.applicationName)
|
||||||
self.copyFile('IEFixes.css.dtml',self.repls,destFolder=self.skinsFolder)
|
self.copyFile('IEFixes.css.dtml',self.repls,destFolder=self.skinsFolder)
|
||||||
|
|
|
@ -775,6 +775,7 @@ class AbstractMixin:
|
||||||
msg = self.translate(u'Your content\'s status has been modified.',
|
msg = self.translate(u'Your content\'s status has been modified.',
|
||||||
domain='plone')
|
domain='plone')
|
||||||
self.plone_utils.addPortalMessage(msg)
|
self.plone_utils.addPortalMessage(msg)
|
||||||
|
self.reindexObject()
|
||||||
return self.goto(urlBack)
|
return self.goto(urlBack)
|
||||||
|
|
||||||
def callAppySelect(self, selectMethod, brains):
|
def callAppySelect(self, selectMethod, brains):
|
||||||
|
@ -1110,24 +1111,22 @@ class AbstractMixin:
|
||||||
performs inter-field validation. This way, the user must first
|
performs inter-field validation. This way, the user must first
|
||||||
correct individual fields before being confronted to potential
|
correct individual fields before being confronted to potential
|
||||||
inter-fields validation errors.'''
|
inter-fields validation errors.'''
|
||||||
obj = self._appy_getWrapper()
|
obj = self.appy()
|
||||||
|
if not hasattr(obj, 'validate'): return
|
||||||
appyRequest = getAppyRequest(REQUEST, obj)
|
appyRequest = getAppyRequest(REQUEST, obj)
|
||||||
try:
|
appyErrors = ValidationErrors()
|
||||||
appyErrors = ValidationErrors()
|
obj.validate(appyRequest, appyErrors)
|
||||||
obj.validate(appyRequest, appyErrors)
|
# This custom "validate" method may have added fields in the given
|
||||||
# This custom "validate" method may have added fields in the given
|
# ValidationErrors instance. Now we must fill the Zope "errors" dict
|
||||||
# ValidationErrors instance. Now we must fill the Zope "errors" dict
|
# based on it. For every error message that is not a string,
|
||||||
# based on it. For every error message that is not a string,
|
# we replace it with the standard validation error for the
|
||||||
# we replace it with the standard validation error for the
|
# corresponding field.
|
||||||
# corresponding field.
|
for key, value in appyErrors.__dict__.iteritems():
|
||||||
for key, value in appyErrors.__dict__.iteritems():
|
resValue = value
|
||||||
resValue = value
|
if not isinstance(resValue, basestring):
|
||||||
if not isinstance(resValue, basestring):
|
msgId = '%s_valid' % self.getLabelPrefix(key)
|
||||||
msgId = '%s_valid' % self.getLabelPrefix(key)
|
resValue = self.utranslate(msgId, domain=self.i18nDomain)
|
||||||
resValue = self.utranslate(msgId, domain=self.i18nDomain)
|
errors[key] = resValue
|
||||||
errors[key] = resValue
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _appy_getPortalType(self, request):
|
def _appy_getPortalType(self, request):
|
||||||
'''Guess the portal_type of p_self from info about p_self and
|
'''Guess the portal_type of p_self from info about p_self and
|
||||||
|
|
20
gen/plone25/templates/global_statusmessage.pt
Normal file
20
gen/plone25/templates/global_statusmessage.pt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" i18n:domain="plone">
|
||||||
|
<body>
|
||||||
|
<tal:message i18n:domain="plone" metal:define-macro="portal_message">
|
||||||
|
<tal:comment replace="nothing">Single message from portal_status_message request key</tal:comment>
|
||||||
|
<div tal:define="msg request/portal_status_message | nothing"
|
||||||
|
tal:condition="msg" class="portalMessage" tal:content="msg" i18n:translate=""></div>
|
||||||
|
|
||||||
|
<tal:comment replace="nothing">Messages added via plone_utils</tal:comment>
|
||||||
|
<tal:messages define="messages putils/showPortalMessages" condition="messages">
|
||||||
|
<tal:msgs define="type_css_map python: {'info':'portalMessage', 'warn':'portalWarningMessage',
|
||||||
|
'stop':'portalStopMessage'};"
|
||||||
|
repeat="msg messages">
|
||||||
|
<div tal:define="mtype msg/type | nothing;"
|
||||||
|
tal:attributes="class python:mtype and type_css_map[mtype] or 'info';"
|
||||||
|
tal:content="structure msg/message | nothing" i18n:translate=""></div>
|
||||||
|
</tal:msgs>
|
||||||
|
</tal:messages>
|
||||||
|
</tal:message>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -160,7 +160,7 @@ def do(transitionName, stateChange, logger):
|
||||||
# We do not notify if the "notify" flag in the flavour is disabled.
|
# We do not notify if the "notify" flag in the flavour is disabled.
|
||||||
doNotify = False
|
doNotify = False
|
||||||
if doAction or doNotify:
|
if doAction or doNotify:
|
||||||
obj = ploneObj._appy_getWrapper(force=True)
|
obj = ploneObj.appy()
|
||||||
if doAction:
|
if doAction:
|
||||||
if type(transition.action) in (tuple, list):
|
if type(transition.action) in (tuple, list):
|
||||||
# We need to execute a list of actions
|
# We need to execute a list of actions
|
||||||
|
|
Loading…
Reference in a new issue