Index: WAeUP_SRP/trunk/Widgets.py
===================================================================
--- WAeUP_SRP/trunk/Widgets.py	(revision 2119)
+++ WAeUP_SRP/trunk/Widgets.py	(revision 2120)
@@ -1498,61 +1498,27 @@
         #import pdb; pdb.set_trace()
         widget_id = self.getWidgetId()
-        fileupload = datastructure[widget_id]
-        dm = datastructure.getDataModel()
-        field_id = self.fields[0]
-        # if isinstance(fileupload, PersistableFileUpload):
-        #     empty_file = False
-        #     session_file = isinstance(fileupload, PersistableFileUpload)
-        #     current_filename = generateFileName(fileupload.filename)
-        #     fileupload.seek(0, 2) # end of file
-        #     size = fileupload.tell()
-        #     fileupload.seek(0)
-        #     last_modified = ''
-        # else:
-        #     empty_file = True
-        #     session_file = False
-        #     current_filename = ''
-        #     size = 0
-        #     last_modified = ''
-        # get the adapter
-        # for adapter in dm._adapters:
-        #     if adapter.getSchema().has_key(field_id):
-        #         break # Note: 'adapter' is still the right one
-        # else:
-        #     raise ValueError('No schema for field %r' % field_id)
-
-        content_url = "/uniben/viewimage?path=%s/%s_%s.jpg" %\
-                                 (self.path,
-                                  datastructure[self.id_field],
-                                  self.getWidgetId(),
-                                  )
-        # registry = getToolByName(self, 'mimetypes_registry')
-        # mimetype = (registry.lookupExtension(current_filename.lower()) or
-        #             registry.lookupExtension('file.bin'))
-
-        # image_info = {
-        #     'empty_file': empty_file,
-        #     'session_file': session_file,
-        #     'current_filename': current_filename,
-        #     'size': size,
-        #     'last_modified': last_modified,
-        #     'content_url': content_url,
-        #     'mimetype': mimetype,
-        #     }
-        # if image_info['empty_file']:
-        #     tag = ''
-        #     height = 0
-        #     width = 0
-        # else:
-        current_filename = "%s_%s.jpg" % (datastructure[self.id_field],
-                                          field_id,)
-        file_path = "/%s/%s" % (self.storage_path,
-                                      current_filename)
-
+        if  datastructure.has_key(widget_id):
+            fileupload = datastructure[widget_id]
+            dm = datastructure.getDataModel()
+            field_id = self.fields[0]
+            content_url = "/uniben/viewimage?path=%s/%s_%s.jpg" %\
+                                    (self.path,
+                                    datastructure[self.id_field],
+                                    self.getWidgetId(),
+                                    )
+            current_filename = "%s_%s.jpg" % (datastructure[self.id_field],
+                                            field_id,)
+            file_path = "/%s/%s" % (self.storage_path,
+                                        current_filename)
+        else:
+            file_path = "XXX"
         # read the file from the filesystem
         if not os.path.exists(file_path):
+            height = -1
+            width = -1
             empty_file = True
             session_file = False
             current_filename = ''
+            content_url = ''
             size = 0
             mimetype = ''
@@ -1621,15 +1587,4 @@
     ###)
 
-    # def getFileName(self, fileupload, datastructure, choice, old_filename=''):
-    #     #filename = datastructure[self.getWidgetId()+'_filename'].strip()
-    #     ext ='jpg'
-    #     filename = "%s_%s.%s" % (datastructure[self.id_field],
-    #                              self.getWidgetId(),
-    #                              ext)
-    #     if choice == 'change' and filename == old_filename:
-    #         # if upload with input field unchanged, use fileupload filename
-    #         filename = cookId('', '', fileupload)[0].strip()
-    #     #filename = cleanFileName(filename or 'file.bin')
-    #     return filename
 
     def checkFileName(self, filename, mimetype):
@@ -1700,5 +1655,5 @@
             if self.size_max and size > self.size_max:
                 max_size_str = self.getHumanReadableSize(self.size_max)
-                err = 'cpsschemas_err_file_too_big ${max_size}'
+                err = 'This file is too big, the allowed max size is ${max_size}'
                 err_mapping = {'max_size': max_size_str}
                 return self.validateError(err, err_mapping, datastructure)
Index: WAeUP_SRP/trunk/skins/waeup_default/widget_passport_render.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/widget_passport_render.pt	(revision 2119)
+++ WAeUP_SRP/trunk/skins/waeup_default/widget_passport_render.pt	(revision 2120)
@@ -34,4 +34,5 @@
       <metal:block use-macro="here/widget_file_render/macros/file_edit">
         <metal:block fill-slot="keep_file" />
+        <metal:block fill-slot="delete_file" />
         <metal:block fill-slot="change_file">
           <input type="file" name="." size="24"
