Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
CMFCore.FSImage.FSImage Class Reference
Inheritance diagram for CMFCore.FSImage.FSImage:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.FSImage.FSImage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def tag
def index_html
def modified
def getContentType
def get_size

Public Attributes

 content_type
 width
 height

Static Public Attributes

string meta_type = 'Filesystem Image'
string content_type = 'unknown/unknown'
string alt = ''
string height = ''
string width = ''
tuple manage_options = ({'label':'Customize', 'action':'manage_main'},)
tuple security = ClassSecurityInfo()
tuple manage_main = Globals.DTMLFile('custimage', _dtmldir)
 manage_FTPget = index_html

Private Member Functions

def _createZODBClone
def _readFile
def _setOldCacheHeaders

Static Private Attributes

 _data = None
 __str__ = Image.__str__.im_func
 The following is mainly taken from OFS/Image.py ###.
 _image_tag = Image.tag.im_func

Detailed Description

FSImages act like images but are not directly
modifiable from the management interface.

Definition at line 36 of file FSImage.py.


Constructor & Destructor Documentation

def CMFCore.FSImage.FSImage.__init__ (   self,
  id,
  filepath,
  fullname = None,
  properties = None 
)

Definition at line 57 of file FSImage.py.

00057 
00058     def __init__(self, id, filepath, fullname=None, properties=None):
00059         id = fullname or id # Use the whole filename.
00060         FSObject.__init__(self, id, filepath, fullname, properties)


Member Function Documentation

def CMFCore.FSImage.FSImage._createZODBClone (   self) [private]

Definition at line 61 of file FSImage.py.

00061 
00062     def _createZODBClone(self):
00063         return Image(self.getId(), '', self._readFile(1))

Here is the caller graph for this function:

def CMFCore.FSImage.FSImage._readFile (   self,
  reparse 
) [private]
Read the data from the filesystem.

Definition at line 64 of file FSImage.py.

00064 
00065     def _readFile(self, reparse):
00066         """Read the data from the filesystem.
00067         """
00068         file = open(self._filepath, 'rb')
00069         try:
00070             data = self._data = file.read()
00071         finally:
00072             file.close()
00073 
00074         if reparse or self.content_type == 'unknown/unknown':
00075             self.ZCacheable_invalidate()
00076             ct, width, height = getImageInfo( data )
00077             self.content_type = ct
00078             self.width = width
00079             self.height = height
00080         return data

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 129 of file FSImage.py.

00129 
00130     def _setOldCacheHeaders(self):
00131         # return False to disable this simple caching behaviour
00132         return _FSCacheHeaders(self)

Here is the call graph for this function:

Here is the caller graph for this function:

    Return the size of the image.

Definition at line 146 of file FSImage.py.

00146 
00147     def get_size(self):
00148         """
00149             Return the size of the image.
00150         """
00151         self._updateFromFS()
00152         return self._data and len( self._data ) or 0

Here is the call graph for this function:

Here is the caller graph for this function:

Get the content type of a file or image.

Returns the content type (MIME type) of a file or image.

Definition at line 137 of file FSImage.py.

00137 
00138     def getContentType(self):
00139         """Get the content type of a file or image.
00140 
00141         Returns the content type (MIME type) of a file or image.
00142         """
00143         self._updateFromFS()
00144         return self.content_type

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.FSImage.FSImage.index_html (   self,
  REQUEST,
  RESPONSE 
)
The default view of the contents of a File or Image.

Returns the contents of the file or image.  Also, sets the
Content-Type HTTP header to the objects content type.

Definition at line 93 of file FSImage.py.

00093 
00094     def index_html(self, REQUEST, RESPONSE):
00095         """
00096         The default view of the contents of a File or Image.
00097 
00098         Returns the contents of the file or image.  Also, sets the
00099         Content-Type HTTP header to the objects content type.
00100         """
00101         self._updateFromFS()
00102         view = _ViewEmulator().__of__(self)
00103 
00104         # If we have a conditional get, set status 304 and return
00105         # no content
00106         if _checkConditionalGET(view, extra_context={}):
00107             return ''
00108 
00109         RESPONSE.setHeader('Content-Type', self.content_type)
00110 
00111         # old-style If-Modified-Since header handling.
00112         if self._setOldCacheHeaders():
00113             # Make sure the CachingPolicyManager gets a go as well
00114             _setCacheHeaders(view, extra_context={})
00115             return ''
00116 
00117         data = self._readFile(0)
00118         data_len = len(data)
00119         RESPONSE.setHeader('Content-Length', data_len)
00120 
00121         #There are 2 Cache Managers which can be in play....
00122         #need to decide which to use to determine where the cache headers
00123         #are decided on.
00124         if self.ZCacheable_getManager() is not None:
00125             self.ZCacheable_set(None)
00126         else:
00127             _setCacheHeaders(view, extra_context={})
00128         return data

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 133 of file FSImage.py.

00133 
00134     def modified(self):
00135         return self.getModTime()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.FSImage.FSImage.tag (   self,
  args,
  kw 
)

Definition at line 87 of file FSImage.py.

00087 
00088     def tag(self, *args, **kw):
00089         # Hook into an opportunity to reload metadata.
00090         self._updateFromFS()
00091         return self._image_tag(*args, **kw)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

CMFCore.FSImage.FSImage.__str__ = Image.__str__.im_func [static, private]

The following is mainly taken from OFS/Image.py ###.

Definition at line 83 of file FSImage.py.

CMFCore.FSImage.FSImage._data = None [static, private]

Definition at line 47 of file FSImage.py.

CMFCore.FSImage.FSImage._image_tag = Image.tag.im_func [static, private]

Definition at line 85 of file FSImage.py.

string CMFCore.FSImage.FSImage.alt = '' [static]

Definition at line 44 of file FSImage.py.

string CMFCore.FSImage.FSImage.content_type = 'unknown/unknown' [static]

Definition at line 43 of file FSImage.py.

Definition at line 73 of file FSImage.py.

string CMFCore.FSImage.FSImage.height = '' [static]

Definition at line 45 of file FSImage.py.

Definition at line 78 of file FSImage.py.

Definition at line 154 of file FSImage.py.

tuple CMFCore.FSImage.FSImage.manage_main = Globals.DTMLFile('custimage', _dtmldir) [static]

Definition at line 55 of file FSImage.py.

tuple CMFCore.FSImage.FSImage.manage_options = ({'label':'Customize', 'action':'manage_main'},) [static]

Definition at line 49 of file FSImage.py.

string CMFCore.FSImage.FSImage.meta_type = 'Filesystem Image' [static]

Definition at line 42 of file FSImage.py.

tuple CMFCore.FSImage.FSImage.security = ClassSecurityInfo() [static]

Definition at line 51 of file FSImage.py.

string CMFCore.FSImage.FSImage.width = '' [static]

Definition at line 46 of file FSImage.py.

Definition at line 77 of file FSImage.py.


The documentation for this class was generated from the following file: