Honesty is paramount. However, if the negatives are significant, then perhaps the teacher should decline writing the letter.
On the other hand, a letter with nothing but glowing remarks may not be entirely believable. A gently worded mention, poerhaps in passing may be adequate.
For example, if the negatives were the fact that the student was occasionall rude to classmates, I see no need to mention it. On the other hand, if there were repeated disciplinary problems, perhaps not writing the letter would be best. But if it was that the student was good but lazy, always doing the minimum amount of work, then saying something like, “While a good student, [name] could work harder.” would be acceptable.