i like the idea of having a __html__ __str__-like function a lot, especially for string/html representation of database objects. is this something that would be compatible with django's design principles?
for implementation, here's a suggestion of which i'm not sure if it works: one could define __str__ functions like def __str__(self, contenttype='text/plain') using different output if specified or raising an exception for unknown content types. can be easily extended to serve text/javascript or other potential representations. just another thought on that issue: is something like >>> red=ColourObject('red','#FF0000') >>> s=ContentString('<html><body><h1>%s</h1></body></html>','text/html') >>> print s%red <html><body><h1><span style="color:#FF0000">red</span></html></body></html> >>> print "spam is %s."%red spam is red. >>> print ContentString(red,'text/css') color:#FF0000; make sense? webograph ps if there is a mime type object in django, this could of course replace the strings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---