Ignore:
Timestamp:
18 Nov 2014, 11:37:28 (10 years ago)
Author:
Henrik Bettermann
Message:

pep8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/files.py

    r11972 r11985  
    3636    CustomerFilesUploadPage)
    3737
    38 grok.context(IIkobaObject) # Make IIkobaObject the default context
     38grok.context(IIkobaObject)  # Make IIkobaObject the default context
    3939grok.templatedir('browser_templates')
     40
    4041
    4142def handle_file_delete(context, view, download_name):
     
    4647    store.deleteFileByContext(context, attr=download_name)
    4748    context.writeLogMessage(view, 'deleted: %s' % download_name)
    48     view.flash(_('${a} deleted.', mapping = {'a':download_name}))
     49    view.flash(_('${a} deleted.', mapping={'a': download_name}))
    4950    return
     51
    5052
    5153def handle_file_upload(upload, context, view, max_size, download_name=None):
     
    6264        view.flash(_('Uploaded file is too big.'), type="danger")
    6365        return False
    64     upload.seek(0) # file pointer moved when determining size
     66    upload.seek(0)  # file pointer moved when determining size
    6567    dummy,ext = os.path.splitext(upload.filename)
    6668    # fpm files are expected to be fingerprint minutiae, file
     
    7072    else:
    7173        file_format = get_fileformat(None, upload.read(512))
    72         upload.seek(0) # same here
     74        upload.seek(0)  # same here
    7375    if file_format is None:
    7476        view.flash(_('Could not determine file type.'), type="danger")
     
    7880        if '.' + file_format != expected_ext:
    7981            view.flash(_('${a} file extension expected.',
    80                 mapping = {'a':expected_ext[1:]}), type="danger")
     82                mapping={'a': expected_ext[1:]}), type="danger")
    8183            return False
    8284    else:
     
    8486            view.flash(
    8587                _('Only the following extensions are allowed: ${a}',
    86                 mapping = {'a':', '.join(ALLOWED_FILE_EXTENSIONS)}),
     88                mapping={'a': ', '.join(ALLOWED_FILE_EXTENSIONS)}),
    8789                type="danger")
    8890            return False
     
    9395    context.writeLogMessage(view, 'uploaded: %s (%s)' % (
    9496        download_name,upload.filename))
    95     view.flash(_('File ${a} uploaded.', mapping = {'a':download_name}))
     97    view.flash(_('File ${a} uploaded.', mapping={'a': download_name}))
    9698    return True
     99
    97100
    98101class FileManager(grok.ViewletManager):
     
    100103    """
    101104    grok.name('files')
     105
    102106
    103107class FileDisplay(grok.Viewlet):
     
    123127        else:
    124128            return False
     129
    125130
    126131class FileUpload(FileDisplay):
     
    179184        return
    180185
     186
    181187class PassportDisplay(FileDisplay):
    182188    """Passport display viewlet.
     
    188194    label = _(u'Passport Picture')
    189195    download_name = u'passport.jpg'
     196
    190197
    191198class PassportUploadManage(FileUpload):
     
    201208    tab_redirect = '#tab2'
    202209
     210
    203211class PassportUploadEdit(PassportUploadManage):
    204212    """Passport upload viewlet for customers.
     
    206214    grok.view(CustomerFilesUploadPage)
    207215    grok.require('waeup.uploadCustomerFile')
     216
    208217
    209218class Image(grok.View):
     
    238247        return image
    239248
     249
    240250class Passport(Image):
    241251    """Renders jpeg passport picture.
     
    244254    download_name = u'passport.jpg'
    245255    grok.context(ICustomer)
    246 
Note: See TracChangeset for help on using the changeset viewer.