In the ExportToModel workflow, show normal message for an absent model file

This commit is contained in:
Benjamin Dauvergne 2011-06-21 20:07:45 +00:00
parent 0d0c5122ea
commit 85c90d1461
1 changed files with 6 additions and 4 deletions

View File

@ -44,8 +44,8 @@ def lax_int(s):
class TemplatingError(quixote.errors.PublishError):
def __init__(self, title, description):
self.title = title
def __init__(self, description):
self.title = _('Templating Error')
self.description = description
ADDITIONAL_VARIABLES = (
@ -773,6 +773,8 @@ class ExportToModelDirectory(Directory):
self.wfstatusitem = wfstatusitem
def _q_index(self):
if not self.wfstatusitem.model_file:
raise TemplatingError(_('No model defined for this action'))
response = get_response()
response.content_type = self.wfstatusitem.model_file.content_type
response.set_header('location', '..')
@ -875,11 +877,11 @@ class ExportToModel(WorkflowStatusItem):
except ezt.UnknownReference, e:
url = formdata.get_url()
get_logger().error('error in template for export to model [%s], unknown reference %s' % (url, str(e)))
raise TemplatingError(_('Templating error'), _('Error in the template, reference %s is unknown') % str(e))
raise TemplatingError(_('Error in the template, reference %s is unknown') % str(e))
except ezt.EZTException, e:
url = formdata.get_url()
get_logger().error('error in template for export to model [%s], model could not be generated' % url)
raise TemplatingError(_('Templating error'), _('Unknown error in the template: %s') % str(e))
raise TemplatingError(_('Unknown error in the template: %s') % str(e))
def get_parameters(self):
return ('label', 'model_file')