Commit 1d06b682 authored by Jim Fulton's avatar Jim Fulton

*** empty log message ***

parent 3f433001
"""Image object that is stored in a file"""
__version__='$Revision: 1.1 $'[11:-2]
from string import rfind
from Globals import package_home
class ImageFile:
"""Image object stored in an external file"""
def __init__(self,path,_prefix=None):
if _prefix is None: _prefix=SOFTWARE_HOME+'/lib/python'
elif type(_prefix) is not type(''): _prefix=package_home(_prefix)
path='%s/%s' % (_prefix, path)
self.path=path
self.content_type='image/%s' % path[rfind(path,'.')+1:]
self.__name__=path[rfind(path,'/')+1:]
def index_html(self, RESPONSE):
"""Default document"""
RESPONSE['content-type']=self.content_type
f=open(self.path)
data=f.read()
f.close()
return data
def __len__(self):
# This is bogus and needed because of the way Python tests truth.
return 1
def __str__(self):
return '<IMG SRC="%s" ALT="%s">' % (self.__name__, self.title_or_id())
*shared* *shared*
# install Main.py # install Main.py
# install Globals.py # install Globals.py
# install ImageFile.py
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment