Changeset 2136


Ignore:
Timestamp:
21 Aug 2007, 09:02:13 (17 years ago)
Author:
joachim
Message:

check for passport picture in widget

Location:
WAeUP_SRP/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Widgets.py

    r2122 r2136  
    15991599        widget_id = self.getWidgetId()
    16001600        file_name = datamodel[self.fields[0]]
     1601        #import pdb; pdb.set_trace()
     1602        if self.allow_resize:
     1603            datastructure[self.getWidgetId() + '_resize'] = ''
    16011604        datastructure[widget_id] = file_name
    16021605        datastructure[widget_id + '_choice'] = 'change'
     
    16081611        """Update datamodel from user data in datastructure.
    16091612        """
    1610         #import pdb; pdb.set_trace()
    16111613        logger = logging.getLogger('Widgets.NoZodbImageWidget.validate')
    16121614        datamodel = datastructure.getDataModel()
     
    16241626        fileupload = datastructure[widget_id]
    16251627        is_upload = isinstance(fileupload, FileUpload)
    1626         if not is_upload:
    1627             return True
     1628        #import pdb; pdb.set_trace()
     1629        if not is_upload and not datamodel[field_id]:
     1630            if self.is_required:
     1631                return self.validateError('cpsschemas_err_required', {},
     1632                                          datastructure)
    16281633        if choice == 'delete':
    16291634            if self.is_required:
     
    16621667            store = True
    16631668
    1664         self.otherProcessing(choice, datastructure)
    16651669
    16661670        # Find filename
    1667         if is_upload:
     1671        if is_upload and store:
    16681672            ext ='jpg'
    16691673            filename = "%s_%s.%s" % (datastructure[self.id_field],
    16701674                                 self.getWidgetId(),
    16711675                                 ext)
     1676            datamodel[field_id] = filename
    16721677            registry = getToolByName(self, 'mimetypes_registry')
    16731678            mimetype = registry.lookupExtension(filename.lower())
    16741679            if mimetype is not None:
    16751680                mimetype = str(mimetype) # normalize
    1676 
    1677         if store:
    16781681            # Set/update data
    1679             file_path = "%s_%s.jpg" % (datamodel[self.id_field],
    1680                                        field_id,)
    1681             full_path = "%s/%s" % (self.storage_path, file_path)
     1682            # file_path = "%s_%s.jpg" % (datamodel[self.id_field],
     1683            #                            field_id,)
     1684            full_path = "%s/%s" % (self.storage_path, filename)
     1685            #import pdb; pdb.set_trace()
    16821686            file = self.makeFile(filename, fileupload, datastructure)
    16831687            # Fixup mimetype
  • WAeUP_SRP/trunk/skins/waeup_student/apply_pume.py

    r2134 r2136  
    117117                                commit = False,
    118118                                )
    119     elif not dm.get('passport'):
    120         mode = "edit"
    121         psm = "Please upload Passport Photograph!"
    122         logger.info('%s tried to submit without uploading a passport foto' % (reg_no))
     119    # elif not dm.get('passport'):
     120    #     mode = "edit"
     121    #     psm = "Please upload Passport Photograph!"
     122    #     logger.info('%s tried to submit without uploading a passport foto' % (reg_no))
    123123    elif not request.has_key('confirm'):
    124124        mode = "edit"
Note: See TracChangeset for help on using the changeset viewer.