From 75fff863516718cf8a292f79773487b115241426 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 16 Mar 2012 11:59:35 +0100 Subject: [PATCH 1/5] enclose filename in quotes to prevent truncation at spaces by browser --- browser/resource.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/resource.py b/browser/resource.py index e2a9816..bb69813 100644 --- a/browser/resource.py +++ b/browser/resource.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 Helmut Merz helmutm@cy55.de +# Copyright (c) 2012 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -207,7 +207,9 @@ class ResourceView(BaseView): data = context.data if useAttachment: filename = adapted(self.context).localFilename or getName(self.context) - if not self.typeOptions('no_normalize_download_filename'): + if self.typeOptions('no_normalize_download_filename'): + filename = '"%s"' % filename + else: filename = NameChooser(getParent(self.context)).normalizeName(filename) response.setHeader('Content-Disposition', 'attachment; filename=%s' % filename) From 7bf87c15ac16cade918ed647645e900e1553f862 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 16 Mar 2012 12:00:57 +0100 Subject: [PATCH 2/5] avoid error when trying to access typeProvider attribute for wrong objects --- browser/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/browser/common.py b/browser/common.py index e96c7ac..540433e 100644 --- a/browser/common.py +++ b/browser/common.py @@ -538,6 +538,8 @@ class BaseView(GenericView, I18NView): @Lazy def typeOptions(self): + if self.typeProvider is None: + return DummyOptions() return IOptions(adapted(self.typeProvider)) def getPredicateOptions(self, relation): From a30ed80e16421c296000edcb7e6b102e94135103 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 16 Mar 2012 12:01:54 +0100 Subject: [PATCH 3/5] fix subreport field definition - needs a reportFactory parameter --- expert/field.py | 2 +- organize/work/report.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/expert/field.py b/expert/field.py index d87165a..567e6e4 100644 --- a/expert/field.py +++ b/expert/field.py @@ -187,4 +187,4 @@ class SubReportField(Field): def getValue(self, row): ri = self.getReportInstance(row) - return ResultSet(ri, ri.getResults()) + return ri.getResults() diff --git a/organize/work/report.py b/organize/work/report.py index c658b48..1851464 100644 --- a/organize/work/report.py +++ b/organize/work/report.py @@ -130,18 +130,6 @@ state = Field('state', u'State', description=u'The state of the work.', executionSteps=['query', 'output']) -# task/event report fields - -taskTitle = UrlField('title', u'Title', - description=u'The short description of the task.', - executionSteps=['output']) -taskDescription = TextField('description', u'Description', - description=u'The long description of the task.', - executionSteps=['output']) -workItems = SubReportField('workItems', u'Work Items', - description=u'A list of work items belonging to the task.', - executionSteps=['output']) - # basic definitions and work report instance @@ -249,6 +237,18 @@ class WorkReportInstance(ReportInstance): # meeting minutes +taskTitle = UrlField('title', u'Title', + description=u'The short description of the task.', + executionSteps=['output']) +taskDescription = TextField('description', u'Description', + description=u'The long description of the task.', + executionSteps=['output']) +workItems = SubReportField('workItems', u'Work Items', + description=u'A list of work items belonging to the task.', + reportFactory=WorkReportInstance, + executionSteps=['output']) + + class TaskRow(BaseRow): pass From ec1628dd00540a08130d8ae17d12da05cb526d00 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 17 Mar 2012 11:53:39 +0100 Subject: [PATCH 4/5] fix generation of result set for subreport fields --- expert/field.py | 4 ++-- organize/work/README.txt | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/expert/field.py b/expert/field.py index eb09d5d..d8d195c 100644 --- a/expert/field.py +++ b/expert/field.py @@ -168,7 +168,7 @@ class TargetField(RelationField): class MultiLineField(Field): - + renderer = 'multiline' def getValue(self, row): @@ -197,4 +197,4 @@ class SubReportField(Field): def getValue(self, row): ri = self.getReportInstance(row) - return ResultSet(ri, ri.getResults()) + return ri.getResults() diff --git a/organize/work/README.txt b/organize/work/README.txt index 5965094..be78def 100644 --- a/organize/work/README.txt +++ b/organize/work/README.txt @@ -280,8 +280,9 @@ We can now access the report using a results view. ... for col in resultsView.displayedColumns: ... print col.getDisplayValue(row), ... print - {'url': 'http://127.0.0.1/loops/views/home/.36', 'title': u'loops Development'} - + {'url': 'http://127.0.0.1/loops/views/home/.36', 'title': u'loops Development'} [] + + Fin de partie From 5a6111acb75146003515f767e7d5d1a550db72ec Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 17 Mar 2012 16:53:42 +0100 Subject: [PATCH 5/5] vocabulary: handle integer and string tokens as equivalent --- expert/field.py | 2 +- organize/work/README.txt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/expert/field.py b/expert/field.py index d8d195c..251c1d8 100644 --- a/expert/field.py +++ b/expert/field.py @@ -93,7 +93,7 @@ class VocabularyField(Field): return value items = self.getVocabularyItems(row) for item in items: - if item['token'] == value: + if str(item['token']) == str(value): return item['title'] def getVocabularyItems(self, row): diff --git a/organize/work/README.txt b/organize/work/README.txt index be78def..5965094 100644 --- a/organize/work/README.txt +++ b/organize/work/README.txt @@ -280,9 +280,8 @@ We can now access the report using a results view. ... for col in resultsView.displayedColumns: ... print col.getDisplayValue(row), ... print - {'url': 'http://127.0.0.1/loops/views/home/.36', 'title': u'loops Development'} [] - - + {'url': 'http://127.0.0.1/loops/views/home/.36', 'title': u'loops Development'} + Fin de partie