[Erp5-report] r7056 - /erp5/trunk/products/ERP5Form/PDFForm.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 3 13:50:03 CEST 2006
Author: jerome
Date: Wed May 3 13:49:59 2006
New Revision: 7056
URL: http://svn.erp5.org?rev=7056&view=rev
Log:
pass keyword arguments to evaluateCell (from Bartek Gorny)
rename EmptyERP5PdfForm to EmptyERP5PdfFormError
Modified:
erp5/trunk/products/ERP5Form/PDFForm.py
Modified: erp5/trunk/products/ERP5Form/PDFForm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/PDFForm.py?rev=7056&r1=7055&r2=7056&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/PDFForm.py (original)
+++ erp5/trunk/products/ERP5Form/PDFForm.py Wed May 3 13:49:59 2006
@@ -240,9 +240,9 @@
allow_class(CalculatedValues)
-class EmptyERP5PdfForm(Exception):
+class EmptyERP5PdfFormError(Exception):
"""Error thrown when you try to display an empty Pdf. """
-allow_class(EmptyERP5PdfForm)
+allow_class(EmptyERP5PdfFormError)
class PDFForm(File):
"""
@@ -445,7 +445,7 @@
def generatePDF(self, REQUEST=None, RESPONSE=None, *args, **kwargs) :
""" generates the PDF with form filled in """
if not self.hasPdfContent() :
- raise EmptyERP5PdfForm, 'Pdf content must be downloaded first'
+ raise EmptyERP5PdfFormError, 'Pdf content must be downloaded first'
values = self.calculateCellValues(REQUEST, *args, **kwargs)
context = { 'here' : self.aq_parent,
'context' : self.aq_parent,
@@ -487,11 +487,15 @@
# list of values that need to be reevaluated (i.e. they depend on the
# value of a cell that was not already evaluated when evaluating them )
uncalculated_values = []
+ # cleanup kw arguments, not to pass `cell` twice to evaluateCell
+ if 'cell' in kwargs:
+ del kwargs['cell']
+
for cell_name in self.cells.keys() :
not_founds = []
value = self.evaluateCell(cell_name, REQUEST = REQUEST,
cell = SafeMapping(CalculatedValues(
- values, cell_name, not_founds)))
+ values, cell_name, not_founds)), **kwargs)
if len(not_founds) != 0 :
uncalculated_values.append(cell_name)
else :
@@ -508,7 +512,7 @@
not_founds = []
value = self.evaluateCell(cell_name, REQUEST = REQUEST,
cell = SafeMapping(CalculatedValues(
- values, cell_name, not_founds)))
+ values, cell_name, not_founds)), **kwargs)
if len(not_founds) == 0 :
uncalculated_values.remove(cell_name)
values[cell_name] = value
@@ -560,7 +564,7 @@
context = { 'here' : self.aq_parent,
'context' : self.aq_parent,
'request' : REQUEST }
- context.update (kwargs)
+ context.update(kwargs)
try :
compiled_tales = getEngine().compile(self.cells[cell_name])
value = getEngine().getContext(context).evaluate(compiled_tales)
More information about the Erp5-report
mailing list