[reportlab-users] Another obscure error, this one regarding PDFPageLabel

Robin Becker robin at reportlab.com
Tue May 19 06:58:54 EDT 2015


...........
>
> Tim,
>
> What you call arrogance is a result of reading the code, adding debug
> statements, learning how it worked, and analyzing, yes, only my, problem.
> However, as you can see from the stack trace you left in the quote, the message
> I suggested subsumes the original message, thus permitting the original message
> to be considered in the unlikely event that there are no duplicate page numbers
> in the page label list. But if there are no duplicate page numbers, there would
> be no attempt to compare PDFPageLabel objects, which are the second item in the
> tuple being sorted, page number being first.
>
> If you can come up with _any_ other scenario that could produce this stack
> trace, I'd be extremely interested.  If not, I'll consider it a little arrogant
> of you make accusations of arrogance.
>
> Glenn
>
..........

Glenn, not sure exactly what Tim is objecting to, but we have a mechanism to 
annotate the original exception.

I suppose this is a python3x issue since it wouldn't happen in python 2.x; I 
guess the correct solution is to ignore the error to preserve the previous 
behaviour.

It obviously makes no sense to have different page numbering schemes for the 
same page, but so far as I can tell Adobe don't care. The question then is 
should we make this an error?

It's fairly trivial to add

	def __lt__(self,oth):
		return False

to the PDFPageLabel class which makes all pagelabels with the same pagenumber 
equal; that way the order in which they appear is fixed by the order of addition 
(python sort is stable).
-- 
Robin Becker


More information about the reportlab-users mailing list