Shane Hathaway wrote:
It would be less evil if the storage exposed extra capabilities to the application though _p_ attributes:
class SimpleFileData:
def __init__(self, bytes): self.bytes = bytes
_p_path_to_data = None
def send(self, RESPONSE): if self _p_path_to_data in not None: # Hurrah! a gift from our storage bytes = open(self._p_path_to_data, 'rb').read() RESPONSE.write(bytes) else: RESPONSE.write(self.bytes)
I like that idea! It builds on the understanding that _p_ attributes are controlled by the database, not the application. Thanks, I'll keep that in mind.
Shane
Yes, this would for example, when using Ape, allow to override the __str__ method of image to render a URL to an external server which would serve directely from the filesystem. Nice. cheers, oliver