Vooke I see what you mean. There's a way in which a liberal bench can rule in their favor, though I wonder how they would phrase the ruling when declaring those sections of the penal code unconstitutional. It will boil down to interpreting the meaning of dignity, privacy and sex. IMHO, the wording of the Constitution and its protections relate to persons rather than their actions, viz.
Art 27 (4) The State shall not discriminate directly or indirectly against any person on any ground, including race, sex, pregnancy, marital status, health status, ethnic or social origin, colour, age, disability, religion, conscience, belief, culture, dress, language or birth.
In other words, a terrorist who blows up a mall (like Westgate) cannot appeal to Art 27(4) for protection on account of his/her sexual orientation, religion, culture or dress. This means the word "SEX" in the Constitution is a state of being of persons rather than the actions by persons in that state of being. This is the same meaning we attach to Articles 52-57 of the Constitution (children, youth, persons with disability, older persons etc).
On dignity, the contention would be that a person has dignity as a person regardless of what they do. To avoid sounding like Clarence Thomas (on the Obergefell case), the courts cannot rule on dignity less or further than stated by the Constitution, and the penal code does not rob someone of that dignity. The issue is whether the penal code authorizes police to go looking for whoever is in a compromising position "against the order of nature". We know that in practice the police don't do that, and cannot possibly do so effectively, such that persons guilty of that have to be in public (for someone else to report them with sustainable evidence), or self-report, which then makes the matter cross from a private matter to the public (by virtue of self-reporting). So the question then would be, who has violated whose dignity?
The same reasoning will probably apply on privacy. What persons do in private remains private unless they choose to make it public, which is what the petitioners are trying to do.