Example #1
0
    def make_post_output(postInfo):
        postInfo['start_date_year_first'] = time.strftime(
            '%Y-%m-%d', time.localtime(postInfo['start_date']))
        postInfo['end_date_year_first'] = time.strftime(
            '%Y-%m-%d', time.localtime(postInfo['end_date']))

        postInfo['start_date'] = time.strftime(
            '%m/%d/%Y', time.localtime(postInfo['start_date']))
        postInfo['end_date'] = time.strftime(
            '%m/%d/%Y', time.localtime(postInfo['end_date']))
        if 'post_date' in postInfo:
            postInfo['post_date'] = time.strftime(
                '%m/%d/%Y %H:%M:%S', time.localtime(postInfo['post_date']))
        if 'gender' in postInfo:
            postInfo[
                'gender'] = 'Male' if postInfo['gender'] == 1 else 'Female'
        if 'age' in postInfo:
            postInfo['age'] = '<1 year' if postInfo[
                'age'] == 0 else '>= 10 years' if postInfo['age'] == 10 else (
                    str(postInfo['age']) + ' years')
        if 'interested' in postInfo:
            postInfo['interested'] = [] if postInfo[
                'interested'] is None else postInfo['interested'].split(',')
        for i in ['image1', 'image2', 'image3']:
            if i in postInfo and postInfo[i] is not None:
                postInfo[i] = ImageHandler.get_image_full_path(postInfo[i])
        return postInfo
Example #2
0
 def make_post_output(postInfo):
     postInfo['start_date'] = time.strftime(
         '%m/%d/%Y', time.localtime(postInfo['start_date']))
     postInfo['end_date'] = time.strftime(
         '%m/%d/%Y', time.localtime(postInfo['end_date']))
     if 'post_date' in postInfo:
         postInfo['post_date'] = time.strftime(
             '%m/%d/%Y %H:%M:%S', time.localtime(postInfo['post_date']))
     for i in ['image1', 'image2', 'image3']:
         if i in postInfo and postInfo[i] is not None:
             postInfo[i] = ImageHandler.get_image_full_path(postInfo[i])
     return postInfo