On Thu, Nov 26, 2009 at 8:40 AM, adelaide_mike <mike.ro...@internode.on.net>wrote:
> In my report generating view I have this (snip): > > if tablename == 'Area': > areas = Area.objects.all() > data.append(['Code','Name','Description']) > for area in areas: > data.append([ > Paragraph(area.area, normalstyle, bulletText=None), > Paragraph(area.nick, normalstyle, bulletText=None), > Paragraph(area.desc, normalstyle, bulletText=None) > ]) > table = Table(data, 1*[0.75*inch]+1*[2.0*inch]+1*[4.0*inch], > style=ts) > > elif tablename == 'Rack': > racks = Rack.objects.all() > data.append(['Code','Name', 'Description']) > for rack in racks: > data.append([ > Paragraph(rack.rack, normalstyle, bulletText=None), > Paragraph(rack.nick, normalstyle, bulletText=None), # > thats line 108 > Paragraph(rack.desc, normalstyle, bulletText=None) > ]) > table = Table(data, 1*[1.25*inch]+1*[2.0*inch]+1*[4.0*inch], > style=ts) > > When tablename = "Area" the .pdf is generated without error. Wnen it > is "Rack" this error is raised: > > Traceback (most recent call last): > > File "/home/mrowan/django/django/core/handlers/base.py", line 86, in > get_response > response = callback(request, *callback_args, **callback_kwargs) > > File "/home/mrowan/projects/cbm/djcbm/cbm/reports.py", line 108, in > print_list > Paragraph(rack.nick, normalstyle, bulletText=None), > > File "/usr/lib/python2.5/site-packages/reportlab/platypus/ > paragraph.py", line 523, in __init__ > self._setup(text, style, bulletText, frags, cleanBlockQuotedText) > > File "/usr/lib/python2.5/site-packages/reportlab/platypus/ > paragraph.py", line 543, in _setup > text = cleaner(text) > > File "/usr/lib/python2.5/site-packages/reportlab/platypus/ > paragraph.py", line 61, in cleanBlockQuotedText > L=filter(truth,map(_lineClean, split(text, '\n'))) > > File "/usr/lib/python2.5/site-packages/reportlab/platypus/ > paragraph.py", line 23, in split > return [uword.encode('utf8') for uword in text.split(delim)] > > AttributeError: 'NoneType' object has no attribute 'split' > > What does the error message mean? Can someone translate please? TIA > It's saying the specified line is trying to call the split method on an object that has no such method. Specifically the object that it is trying to call split on is None, so the value of text on that line is None. That would seem to imply (assuing text is the first argument to Paragraph and it hasn't been set to None between the time the initial __init__ for Paragraph was entered and the time the error is raised), that there is a Rack in the db where rack.nick is None. Which seems odd -- assuming nick is a CharField, unless you have it declared with null=True, an "empty" nick ought to be an empty string, not None. Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.