Changeset 7038 for main


Ignore:
Timestamp:
8 Nov 2011, 20:48:58 (13 years ago)
Author:
uli
Message:

Remove obsolete imports/code, reorder imports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/ulif-extimgstore/src/waeup/sirp/applicants/applicant.py

    r7002 r7038  
    2323import grok
    2424from grok import index
    25 from zope.component import getUtility
    2625from zope.component.interfaces import IFactory
    2726from zope.interface import implementedBy
    2827from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    29 from waeup.sirp.interfaces import IObjectHistory, IExtFileStore
    3028from waeup.sirp.app import University
     29from waeup.sirp.image import WAeUPImageFile
     30from waeup.sirp.imagestorage import DefaultFileStoreHandler
     31from waeup.sirp.interfaces import (
     32    IObjectHistory, IFileStoreHandler, IFileStoreNameChooser)
     33from waeup.sirp.utils.helpers import attrs_to_fields
    3134from waeup.sirp.applicants.interfaces import (
    32     IResultEntry, IApplicant, IApplicantEdit, default_passport_image,
     35    IResultEntry, IApplicant, IApplicantEdit,
    3336    )
    34 from waeup.sirp.image import WAeUPImageFile
    35 from waeup.sirp.utils.helpers import attrs_to_fields
     37
    3638
    3739def get_regno_or_ac(context):
     
    5759        self.application_date = None
    5860        return
    59 
    60     #def getApplicantsRootLogger(self):
    61     #    return grok.getSite()['applicants'].logger
    6261
    6362    def loggerInfo(self, ob_class, comment=None):
     
    9089    access_code = index.Field(attribute='access_code')
    9190
    92 #class ApplicantTraverser(grok.Traverser):
    93 #    """Get image of the context applicant.
    94 #
    95 #    Each applicant can provide a passport photograph which will be
    96 #    returned by this traverser if:
    97 #
    98 #    - we request the exact filename of the picture or
    99 #
    100 #    - ask for a picture named 'passport.jpg'.
    101 #
    102 #    If no picture was stored yet, we get a placeholder image when
    103 #    asking for `passport.jpg`.
    104 #
    105 #    If none of the above applies, we return ``None``, most probably
    106 #    resulting a :exc:`NotFound` exception.
    107 #
    108 #    """
    109 #    grok.context(IApplicant)
    110 #    def traverse(self, name):
    111 #        if name != 'passport.jpg':
    112 #            return
    113 #        marked_filename = '__img_appl__%s.jpg' % (
    114 #            get_regno_or_ac(self.context))
    115 #        image = getUtility(IExtFileStore).getFile(marked_filename)
    116 #        if image is None:
    117 #            # Return placeholder
    118 #            from waeup.sirp.applicants.interfaces import IMAGE_PATH
    119 #            return open(os.path.join(IMAGE_PATH, 'placeholder_m.jpg'), 'rb')
    120 #            pass
    121 #        return image #WAeUPImageFile(marked_filename, image.read())
    122 #        if not hasattr(self.context, 'passport'):
    123 #            return None
    124 #        passport_filename = getattr(self.context.passport, 'filename', None)
    125 #        if name == passport_filename:
    126 #            return self.context.passport
    127 #        if name == 'passport.jpg':
    128 #            if self.context.passport is not None:
    129 #                return self.context.passport
    130 #        return
    131 
    13291class ApplicantFactory(grok.GlobalUtility):
    13392    """A factory for applicants.
     
    144103        return implementedBy(Applicant)
    145104
    146 from waeup.sirp.interfaces import IFileStoreHandler, IFileStoreNameChooser
    147 from waeup.sirp.imagestorage import DefaultFileStoreHandler
    148105
     106#: The file id marker for applicant passport images
    149107APPLICANT_IMAGE_STORE_NAME = 'img-applicant'
    150108
Note: See TracChangeset for help on using the changeset viewer.