0

I'm creating a pdf report using reportlab and django. I have a simple table data that is defined like this:

table = Table([[x.date, x.person, x.person.company, x.total, ]
                for x in page])

My problem is, x.total is a method that returns a float. This leaves me with a nasty "bound method Trip.total of Trip: 201..." in the pdf.

How can I force the evaluation of the expression inside the list? I'm sure this is quite dumb, but I don't seem to find any useful link

1
  • 2
    What if you just call it? x.total(). Commented Apr 27, 2014 at 0:05

2 Answers 2

2

You should be able to call the function in place:

table = Table([[x.date, x.person, x.person.company, x.total(), ]
                for x in page])
Sign up to request clarification or add additional context in comments.

1 Comment

I feel dumb!! Thanks a lot
0

Alternatively, this wasn't working because I missed the @property decorator. This is also why this has worked for me before

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.