Commit ec783b49 authored by Jérome Perrin's avatar Jérome Perrin

fix indentation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3674 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3679cdcf
...@@ -80,13 +80,13 @@ class PDFTk : ...@@ -80,13 +80,13 @@ class PDFTk :
if hasattr(pdfFile, "read") : if hasattr(pdfFile, "read") :
pdfFile = pdfFile.read() pdfFile = pdfFile.read()
tmpPdfFile=open(pdfFormFileName, "w") tmpPdfFile = open(pdfFormFileName, "w")
tmpPdfFile.write(pdfFile) tmpPdfFile.write(pdfFile)
tmpPdfFile.close() tmpPdfFile.close()
if hasattr(fdfFile, "read") : if hasattr(fdfFile, "read") :
fdfFile = fdfFile.read() fdfFile = fdfFile.read()
tmpFdfFile=open(fdfFormFileName, "w") tmpFdfFile = open(fdfFormFileName, "w")
tmpFdfFile.write(fdfFile) tmpFdfFile.write(fdfFile)
tmpFdfFile.close() tmpFdfFile.close()
...@@ -162,7 +162,7 @@ class PDFTk : ...@@ -162,7 +162,7 @@ class PDFTk :
fdf = "%FDF-1.2\x0d%\xe2\xe3\xcf\xd3\x0d\x0a" fdf = "%FDF-1.2\x0d%\xe2\xe3\xcf\xd3\x0d\x0a"
fdf += "1 0 obj\x0d<< \x0d/FDF << /Fields [ " fdf += "1 0 obj\x0d<< \x0d/FDF << /Fields [ "
for key, value in values.items(): for key, value in values.items():
fdf += "<< /T (%s) /V (%s)>> \x0d"%( fdf += "<< /T (%s) /V (%s)>> \x0d" % (
self._escapeString(key), self._escapeString(key),
self._escapeString(value)) self._escapeString(value))
...@@ -220,6 +220,7 @@ class CalculatedValues : ...@@ -220,6 +220,7 @@ class CalculatedValues :
# doesn't complain that NoneType doesn't support + when a1 not found # doesn't complain that NoneType doesn't support + when a1 not found
return self.__values[attr] return self.__values[attr]
__getattr__ = __getitem__ __getattr__ = __getitem__
allow_class(CalculatedValues) allow_class(CalculatedValues)
...@@ -242,8 +243,7 @@ class PDFForm(File): ...@@ -242,8 +243,7 @@ class PDFForm(File):
# Constructors # Constructors
constructors = (manage_addPDFForm, addPDFForm) constructors = (manage_addPDFForm, addPDFForm)
manage_options = ( manage_options = ( (
(
{'label':'Edit Cell TALES', 'action':'manage_cells'}, {'label':'Edit Cell TALES', 'action':'manage_cells'},
{'label':'Display Cell Names', 'action':'showCellNames'}, {'label':'Display Cell Names', 'action':'showCellNames'},
{'label':'Test PDF generation', 'action':'generatePDF'}, {'label':'Test PDF generation', 'action':'generatePDF'},
...@@ -292,7 +292,7 @@ class PDFForm(File): ...@@ -292,7 +292,7 @@ class PDFForm(File):
file.seek(0) file.seek(0)
File.manage_upload(self, file, REQUEST) File.manage_upload(self, file, REQUEST)
if REQUEST: if REQUEST:
message="Saved changes." message = "Saved changes."
return self.manage_main(self, REQUEST, manage_tabs_message=message) return self.manage_main(self, REQUEST, manage_tabs_message=message)
security.declareProtected('View management screens', 'manage_cells') security.declareProtected('View management screens', 'manage_cells')
...@@ -352,7 +352,7 @@ class PDFForm(File): ...@@ -352,7 +352,7 @@ class PDFForm(File):
RESPONSE.setHeader('Content-Type', 'application/pdf') RESPONSE.setHeader('Content-Type', 'application/pdf')
RESPONSE.setHeader('Content-Length', len(pdf)) RESPONSE.setHeader('Content-Length', len(pdf))
RESPONSE.setHeader('Content-Disposition', RESPONSE.setHeader('Content-Disposition',
'inline;filename="%s.template.pdf"'%( 'inline;filename="%s.template.pdf"' % (
self.title_or_id())) self.title_or_id()))
return pdf return pdf
...@@ -378,7 +378,8 @@ class PDFForm(File): ...@@ -378,7 +378,8 @@ class PDFForm(File):
""" generates the PDF with form filled in """ """ generates the PDF with form filled in """
values = self.calculateCellValues(REQUEST, *args, **kwargs) values = self.calculateCellValues(REQUEST, *args, **kwargs)
context = {'here' : self.aq_parent, 'request' : REQUEST} context = {'here' : self.aq_parent, 'request' : REQUEST}
if hasattr(self, "__format_method__") and self.__format_method__ not in ('', None) : if hasattr(self, "__format_method__") \
and self.__format_method__ not in ('', None) :
compiled_tales = getEngine().compile(self.__format_method__) compiled_tales = getEngine().compile(self.__format_method__)
format_method = getEngine().getContext(context).evaluate(compiled_tales) format_method = getEngine().getContext(context).evaluate(compiled_tales)
# try to support both method name and method object # try to support both method name and method object
...@@ -388,7 +389,7 @@ class PDFForm(File): ...@@ -388,7 +389,7 @@ class PDFForm(File):
for k, v in values.items() : for k, v in values.items() :
values[k] = format_method(v, cell_name=k) values[k] = format_method(v, cell_name=k)
else : else :
LOG("PDFForm", 0, 'format method ("%r") is not callable' % format_method) LOG("PDFForm", 0, 'format method (%r) is not callable' % format_method)
data = str(self.data) data = str(self.data)
if self.__page_range__ not in ('', None) : if self.__page_range__ not in ('', None) :
compiled_tales = getEngine().compile(self.__page_range__) compiled_tales = getEngine().compile(self.__page_range__)
...@@ -439,7 +440,7 @@ class PDFForm(File): ...@@ -439,7 +440,7 @@ class PDFForm(File):
uncalculated_values.remove(cell_name) uncalculated_values.remove(cell_name)
values[cell_name] = value values[cell_name] = value
if len(uncalculated_values) == uncalculated_values_len : if len(uncalculated_values) == uncalculated_values_len :
raise "Circular reference", "unable to evaluate cells " \ raise ValueError, "Circular reference: unable to evaluate cells " \
+ `uncalculated_values` + `uncalculated_values`
security.declareProtected('View', 'getCellNames') security.declareProtected('View', 'getCellNames')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment