src/reportlab/platypus/doctemplate.py
changeset 3131 0f15fabe9d8d
parent 3129 171184fe71d2
child 3161 5717a3003dc3
equal deleted inserted replaced
3130:0770d19dc052 3131:0f15fabe9d8d
    45 import logging
    45 import logging
    46 logger = logging.getLogger("reportlab.platypus")
    46 logger = logging.getLogger("reportlab.platypus")
    47 
    47 
    48 class LayoutError(Exception):
    48 class LayoutError(Exception):
    49     pass
    49     pass
       
    50 
       
    51 def _fSizeString(f):
       
    52     w=getattr(f,'width',None)
       
    53     if w is None:
       
    54         w=getattr(f,'_width',None)
       
    55 
       
    56     h=getattr(f,'height',None)
       
    57     if h is None:
       
    58         h=getattr(f,'_height',None)
       
    59     if w is not None or h is not None:
       
    60         if w is None: w='???'
       
    61         if h is None: h='???'
       
    62         return '(%s x %s)' % (w,h)
       
    63     return ''
    50 
    64 
    51 def _doNothing(canvas, doc):
    65 def _doNothing(canvas, doc):
    52     "Dummy callback for onPage"
    66     "Dummy callback for onPage"
    53     pass
    67     pass
    54 
    68 
   689                         del S[0]
   703                         del S[0]
   690                     for i,f in enumerate(S):
   704                     for i,f in enumerate(S):
   691                         flowables.insert(i,f)   # put split flowables back on the list
   705                         flowables.insert(i,f)   # put split flowables back on the list
   692                 else:
   706                 else:
   693                     if hasattr(f,'_postponed'):
   707                     if hasattr(f,'_postponed'):
   694                         ident = "Flowable %s too large on page %d in frame '%s' of template '%s'" % \
   708                         ident = "Flowable %s%s too large on page %d in frame %r%s of template %r" % \
   695                                 (self._fIdent(f,60,frame), self.page, self.frame.id, self.pageTemplate.id)
   709                                 (self._fIdent(f,60,frame),_fSizeString(f),self.page, self.frame.id,
       
   710                                         self.frame._aSpaceString(), self.pageTemplate.id)
   696                         #leave to keep apart from the raise
   711                         #leave to keep apart from the raise
   697                         raise LayoutError(ident)
   712                         raise LayoutError(ident)
   698                     # this ought to be cleared when they are finally drawn!
   713                     # this ought to be cleared when they are finally drawn!
   699                     f._postponed = 1
   714                     f._postponed = 1
   700                     mbe = getattr(self,'_multiBuildEdits',None)
   715                     mbe = getattr(self,'_multiBuildEdits',None)