There is a possible problem in gluon/contrib/fpsf/fpdf.py when the user 
leaves an entry blank. 
What is the process for submitting this issue in the new reporting 
procedure?


51.    filler = False
52.    for row in db_rows:
53.            pdf.cell(25,5,row.case_number,1, fill=filler)
54.
55.            pdf.cell(35,5,row.member_id.last_name,1,fill=filler)
56.            pdf.cell(25,5,str(row.date_assigned),1,fill=filler)
57.            pdf.multi_cell(95,5,*row.description*,border=1,fill=filler ) 
*<------*
58.            pdf.ln(5)
59.            filler = not filler

If the description field is empty then the the preceding innocent looking 
code results in the following error: 

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 220, in restricted
    exec ccode in environment
  File "/home/www-data/web2py/applications/indep/controllers/reports.py", 
line 139, in <module>
  File "/home/www-data/web2py/gluon/globals.py", line 385, in <lambda>
    self._caller = lambda f: f()
  File "/home/www-data/web2py/applications/indep/controllers/reports.py", 
line 57, in cases_pdf
    pdf.multi_cell(95,5,row.description,border=1,fill=filler )
  File "/home/www-data/web2py/gluon/contrib/fpdf/fpdf.py", line 730, in 
multi_cell
    if txt == Null:
AttributeError: 'NoneType' object has no attribute 'replace'

The problem is the following line 730 in fpdf.py

 729         wmax=(w-2*self.c_margin)*1000.0/self.font_size
 *730         s=txt.replace("\r",'')*    <----------------
 731         nb=len(s)
 732         if(nb>0 and s[nb-1]=="\n"):
 733
 
 My BFI (brute force and ignorance) fix was the following:
 729         wmax=(w-2*self.c_margin)*1000.0/self.font_size
 730         if txt == None:
 731             s = ""
 732         else:
 733             s=txt.replace("\r",'')
 734         nb=len(s)
 735         if(nb>0 and s[nb-1]=="\n"):
 
 
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to