Add a template tag to dump an object a'la perl's
Data::Dumper
Comments:
Mike: 2004-08-17 17:01 [quote]
Created an attachment (id=7)
AnalyzeThat module and demo
posts from the mod_python list are in the bug comments
Mike: 2004-08-17 17:02 [quote]
From: Amir Salihefendic <amix@amix.dk>
Subject: [mod_python] Introducing AnalyzeThat!
Date: Tue, 17 Aug 2004 18:29:17 +0200
I was pretty tired of the way that you test out stuff
in mod_python.
I.e. you use req.write(variable),
req.write(dir(object)) etc.
Therefor I sat down - and thought of a good way to
analyze stuff.
I thought, let's make it this way:
- Throw anything in - abracadabra - you get some
informative output -
that also is readable.
And some hours later I have class AnalyzeThat :-)
Throw anything in AnalyzeThat and it generates some
informative and
readable output.
Following types are supported (i.e. there are written
explicit handlers
for them):
Int, Str, Tuple, List, Dict, Module and Function. I had
also support
for boolean (but it does not work in Python 2.2, so I
removed it
again).
Other types are also supported - they just don't have
their own
handlers.
For a better overview check out:
http://amix.dk/at/index.py
If anybody has any additions I would be very glad to
implement them - -
in the final version of the class.
Kind regards
Amir Salihefendic
-----
What we do in life echoes in eternity
_______________________________________________
Mod_python mailing list
Mod_python@modpython.org
http://mailman.modpython.org/mailman/listinfo/mod_python
Mike: 2004-08-17 17:02 [quote]
From: 4mix <amix@amix.dk>
Subject: Re: [mod_python] Introducing AnalyzeThat!
Date: Tue, 17 Aug 2004 19:41:54 +0200
Hello again
http://amix.dk/at/at.zip
Here is the source if anybody wants to contribute - or
use it (this is
only a test version thought),
I have also added index.py - a publisher-handler
primitive "unit-test".
Base class is AnalyzeThat.
Template class (where all the HTML stuff is created) is
in class called
AnalyzeThatTemplate
Handler class (which also has little HTML) is called
AnalyzeThatHandlers.
The flow is:
AnalyzeThat.__init__;
Sets self.object
Sets self.type (type of the object)
Checks what type it is.
self.content is set depending on what type it is. Some
types have their
own handlers.
_renderLayer (located in AnalyzeThatTemplate) is called
- it's main
function is to get information form self.content and to
write that info
in HTML.
Be-aware: No documentation and shit loads of list
comprehension's :-D
But I think it's easy to understand if you start off
from class
AnalyzeThat
4mix (http://amix.dk)
------------------------------------------------
What we do in life echoes in eternity
_______________________________________________
Mod_python mailing list
Mod_python@modpython.org
http://mailman.modpython.org/mailman/listinfo/mod_python
AnalyzeThat module