durusmail: qp: DurusDirectory
DurusDirectory
2005-11-30
2005-11-30
DurusDirectory
mario ruggier
2005-11-30
The DurusDirectory class is real nice... it would be awesome to have it
also allow editing of values, all introspectively automagical. That
will come i'm sure ;)

I have, of course, subclassed this class and I have these 2 minor
suggestions.

First, as this is a "recursive" directory class, the _q_lookup() method
creates a new instance for looked up components...

     def _q_lookup(self, component):
         try:
             return DurusDirectory(
                 get_publisher().get_connection().get(int(component)))
         except ValueError:
             return None

However, wouldn't it be more correct if it used self.__class__ instead
of DurusDirectory to use itself recursively?

The other suggestion is for the display method, that nests the format()
function. Because this nested function is rather generic object
formatter, and display() is really about page layout, wouldn't it be
better to just make format() an external generic helper function?
Actually, I would also suggest to collect these "dev/debug/useful"
functions in one place... I have for example a fill.debug module where
I have put format_sessions(), format_request(), and format_p_obj().

mario

reply