From f64493764fbd56cfc2f47a62eda5ce6ffcc32672 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Mon, 15 Sep 2014 18:32:45 +0200 Subject: [PATCH] [gen] bugfixes in the pod field. --- fields/pod.py | 15 ++++++--------- gen/wrappers/__init__.py | 5 +---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/fields/pod.py b/fields/pod.py index d6a6535..5423281 100644 --- a/fields/pod.py +++ b/fields/pod.py @@ -193,6 +193,9 @@ class Pod(Field): self.stylesMapping = stylesMapping # What are the output formats when generating documents from this pod ? self.formats = formats + if not formats: # Compute default ones + ext = self.getExtension(self.template[0]) + self.formats = Pod.allFormats[ext] # Parameter "getChecked" can specify the name of a Ref field belonging # to the same gen class. If it is the case, the context of the pod # template will contain an additional object, name "_checked", and @@ -200,13 +203,6 @@ class Pod(Field): # objects linked via the Ref field that are currently selected in the # user interface. self.getChecked = getChecked - if not formats: - # Compute default ones - ext = self.getExtension(self.template[0]) - if ext == '.ods': - self.formats = ('xls', 'ods') - else: - self.formats = ('pdf', 'doc', 'odt') Field.__init__(self, None, (0,1), default, show, page, group, layouts, move, indexed, searchable, specificReadPermission, specificWritePermission, width, height, None, colspan, @@ -308,8 +304,9 @@ class Pod(Field): for template in self.template: formats = self.showTemplate(obj, template) if not formats: continue - formats = isManager and self.getAllFormats(template) or formats - if isinstance(formats, basestring): formats = (formats,) + if isManager: formats = self.getAllFormats(template) + elif isinstance(formats, bool): formats = self.formats + elif isinstance(formats, basestring): formats = (formats,) res.append(Object(template=template, formats=formats, freezeFormats=self.getFreezeFormats(obj, template))) return res diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index 7258323..cc2ea0f 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -741,10 +741,7 @@ class AbstractWrapper(object): elif name == 'state': return self.o.State() elif name == 'stateLabel': return self.o.translate(self.o.getWorkflowLabel()) - elif name == 'history': - o = self.o - key = o.workflow_history.keys()[0] - return o.workflow_history[key] + elif name == 'history': return self.o.workflow_history['appy'] elif name == 'user': return self.o.getTool().getUser() elif name == 'fields': return self.o.getAllAppyTypes() elif name == 'siteUrl': return self.o.getTool().getSiteUrl()