Overriding builtin getattr method
Raja Raman Sundararajan
ram0812 at hotmail.com
Tue Oct 3 10:24:22 CEST 2006
I have data stored in the database which has special characters
like <, > etc.
Case 1: Whenever I wanted to present the output to a browser
I need to escape these special characters into the browser
equivalent like < > etc.( for example by using the cgi module)
Case 2: Whenever I wanted to present the output to some client other
than a browser, I wanted to present the data as it is stored in the
For doing this I thought of overriding the __builtin__.__getattr__
I am wondering if there is any other way of achieving this. I have
loads of files that get the attribute values of objects stored in the
database and I do not want to manually change the way of DB access in
those files. I rather prefer a centralized way to achieve this.
Good inputs are always appreciated.
More information about the Python-list