Commit cc3ec6f5 authored by 's avatar

Added last_modified, size

parent 32f0a33d
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
############################################################################## ##############################################################################
"""Image object""" """Image object"""
__version__='$Revision: 1.50 $'[11:-2] __version__='$Revision: 1.51 $'[11:-2]
import Globals import Globals
from Globals import HTMLFile, MessageDialog from Globals import HTMLFile, MessageDialog
...@@ -174,7 +174,7 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -174,7 +174,7 @@ class File(Persistent,Implicit,PropertyManager,
if not content_type: if not content_type:
raise 'BadValue', 'No content type specified.' raise 'BadValue', 'No content type specified.'
data=(headers is None) and file or file.read() data=(headers is None) and file or file.read()
self._update_data(data, content_type) self.post_process(data, content_type)
def id(self): def id(self):
return self.__name__ return self.__name__
...@@ -205,7 +205,7 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -205,7 +205,7 @@ class File(Persistent,Implicit,PropertyManager,
""" """
raise 'Redirect', URL1 raise 'Redirect', URL1
def _update_data(self, data, content_type=None): def post_process(self, data, content_type=None):
if content_type is not None: if content_type is not None:
self.content_type=content_type self.content_type=content_type
self.data=Pdata(data) self.data=Pdata(data)
...@@ -233,7 +233,7 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -233,7 +233,7 @@ class File(Persistent,Implicit,PropertyManager,
if file.headers.has_key('content-type'): if file.headers.has_key('content-type'):
content_type=file.headers['content-type'] content_type=file.headers['content-type']
else: content_type=None else: content_type=None
self._update_data(file.read(), content_type) self.post_process(file.read(), content_type)
if REQUEST: return MessageDialog( if REQUEST: return MessageDialog(
title ='Success!', title ='Success!',
message='Your changes have been saved', message='Your changes have been saved',
...@@ -249,7 +249,7 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -249,7 +249,7 @@ class File(Persistent,Implicit,PropertyManager,
def PUT(self, BODY, REQUEST): def PUT(self, BODY, REQUEST):
"""Handle HTTP PUT requests""" """Handle HTTP PUT requests"""
content_type=REQUEST.get('CONTENT_TYPE', None) content_type=REQUEST.get('CONTENT_TYPE', None)
self._update_data(BODY, content_type) self.post_process(BODY, content_type)
def getSize(self): def getSize(self):
"""Get the size of a file or image. """Get the size of a file or image.
...@@ -309,7 +309,7 @@ class Image(File): ...@@ -309,7 +309,7 @@ class Image(File):
kind='image') kind='image')
manage=manage_main=manage_editForm manage=manage_main=manage_editForm
def _update_data(self, data, content_type=None): def post_process(self, data, content_type=None):
if content_type is not None: if content_type is not None:
self.content_type=content_type self.content_type=content_type
self.data=Pdata(data) self.data=Pdata(data)
......
...@@ -21,6 +21,22 @@ ...@@ -21,6 +21,22 @@
<!--#/if title--> <!--#/if title-->
</TD> </TD>
</TR> </TR>
<tr>
<th align="left" valign="top">
<em>Size</em>
</th>
<td align="left" valign="top">
<!--#var get_size thousands_commas--> bytes
</td>
</tr>
<tr>
<th align="left" valign="top">
<em>Last modified</em>
</th>
<td align="left" valign="top">
<!--#var bobobase_modification_time-->
</td>
</tr>
<TR> <TR>
<TD COLSPAN="2" ALIGN="CENTER"> <TD COLSPAN="2" ALIGN="CENTER">
<TEXTAREA NAME="data:text" WRAP="Off" <TEXTAREA NAME="data:text" WRAP="Off"
......
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