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 :
if hasattr(pdfFile, "read") :
pdfFile = pdfFile.read()
tmpPdfFile=open(pdfFormFileName, "w")
tmpPdfFile = open(pdfFormFileName, "w")
tmpPdfFile.write(pdfFile)
tmpPdfFile.close()
if hasattr(fdfFile, "read") :
fdfFile = fdfFile.read()
tmpFdfFile=open(fdfFormFileName, "w")
tmpFdfFile = open(fdfFormFileName, "w")
tmpFdfFile.write(fdfFile)
tmpFdfFile.close()
......@@ -162,7 +162,7 @@ class PDFTk :
fdf = "%FDF-1.2\x0d%\xe2\xe3\xcf\xd3\x0d\x0a"
fdf += "1 0 obj\x0d<< \x0d/FDF << /Fields [ "
for key, value in values.items():
fdf += "<< /T (%s) /V (%s)>> \x0d"%(
fdf += "<< /T (%s) /V (%s)>> \x0d" % (
self._escapeString(key),
self._escapeString(value))
......@@ -220,6 +220,7 @@ class CalculatedValues :
# doesn't complain that NoneType doesn't support + when a1 not found
return self.__values[attr]
__getattr__ = __getitem__
allow_class(CalculatedValues)
......@@ -242,8 +243,7 @@ class PDFForm(File):
# Constructors
constructors = (manage_addPDFForm, addPDFForm)
manage_options = (
(
manage_options = ( (
{'label':'Edit Cell TALES', 'action':'manage_cells'},
{'label':'Display Cell Names', 'action':'showCellNames'},
{'label':'Test PDF generation', 'action':'generatePDF'},
......@@ -292,7 +292,7 @@ class PDFForm(File):
file.seek(0)
File.manage_upload(self, file, REQUEST)
if REQUEST:
message="Saved changes."
message = "Saved changes."
return self.manage_main(self, REQUEST, manage_tabs_message=message)
security.declareProtected('View management screens', 'manage_cells')
......@@ -352,7 +352,7 @@ class PDFForm(File):
RESPONSE.setHeader('Content-Type', 'application/pdf')
RESPONSE.setHeader('Content-Length', len(pdf))
RESPONSE.setHeader('Content-Disposition',
'inline;filename="%s.template.pdf"'%(
'inline;filename="%s.template.pdf"' % (
self.title_or_id()))
return pdf
......@@ -378,7 +378,8 @@ class PDFForm(File):
""" generates the PDF with form filled in """
values = self.calculateCellValues(REQUEST, *args, **kwargs)
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__)
format_method = getEngine().getContext(context).evaluate(compiled_tales)
# try to support both method name and method object
......@@ -388,7 +389,7 @@ class PDFForm(File):
for k, v in values.items() :
values[k] = format_method(v, cell_name=k)
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)
if self.__page_range__ not in ('', None) :
compiled_tales = getEngine().compile(self.__page_range__)
......@@ -439,7 +440,7 @@ class PDFForm(File):
uncalculated_values.remove(cell_name)
values[cell_name] = value
if len(uncalculated_values) == uncalculated_values_len :
raise "Circular reference", "unable to evaluate cells " \
raise ValueError, "Circular reference: unable to evaluate cells " \
+ `uncalculated_values`
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