Ignore:
Timestamp:
9 Nov 2011, 15:42:45 (13 years ago)
Author:
uli
Message:

Merge changes from branch ulif-extimgstore back into trunk.
Beside external image storage also waeupdocs should work again.

Location:
main/waeup.sirp/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk

  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r6915 r7063  
    2929
    3030from zope import schema
    31 from zope.interface import Interface, Attribute, provider
     31from zope.interface import Interface, Attribute
    3232from zope.component import getUtilitiesFor
    3333from zope.pluggableauth.interfaces import IPrincipalInfo
    3434from zope.security.interfaces import IGroupClosureAwarePrincipal as IPrincipal
    3535from zc.sourcefactory.basic import BasicSourceFactory
    36 from waeup.sirp.image import createWAeUPImageFile
    37 from waeup.sirp.image.schema import ImageFile
    3836from waeup.sirp.interfaces import IWAeUPObject, year_range
    3937from waeup.sirp.university.vocabularies import application_categories
     
    6664    return True
    6765
    68 @provider(schema.interfaces.IContextAwareDefaultFactory)
    69 def default_passport_image(context):
    70     """A default value factory for ImageFile fields.
    71 
    72     Returns some default image as WAeUPImageFile. We cannot set the
    73     default directly in ImageFile fields, as, if we want to set
    74     max_size or min_size as well, some utility lookups are needed
    75     which are not possible during startup.
    76 
    77     Developers which use IContextAwareDefaultFactories like this one
    78     always should make sure that the delivered default meets all
    79     constraints of the field that makes use of this default value
    80     provider.
    81     """
    82     imagefile = createWAeUPImageFile(
    83         'placeholder_m.jpg',
    84         open(os.path.join(IMAGE_PATH, 'placeholder_m.jpg'), 'r')
    85         )
    86     return imagefile
    87 
    8866class ApplicantContainerProviderSource(BasicSourceFactory):
    8967    """A source offering all available applicants container types.
     
    370348        required = False,
    371349        )
    372     passport = ImageFile(
    373         title = u'Passport Photograph',
    374         #default = DEFAULT_PASSPORT_IMAGE_MALE,
    375         defaultFactory = default_passport_image,
    376         description = u'Maximun file size is 20 kB.',
    377         required = True,
    378         max_size = 20480,
    379         )
     350    #passport = ImageFile(
     351    #    title = u'Passport Photograph',
     352    #    #default = DEFAULT_PASSPORT_IMAGE_MALE,
     353    #    defaultFactory = default_passport_image,
     354    #    description = u'Maximun file size is 20 kB.',
     355    #    required = True,
     356    #    max_size = 20480,
     357    #    )
    380358
    381359    #
Note: See TracChangeset for help on using the changeset viewer.