Beispiel #1
0
 def dehydrate(self, bundle):
     ''' Dehydrate to calc stuff on its way out '''
     
     # Class will always have a created/modified due to default.
     bundle.data['informal_created'] = calculate_informal_time(bundle.data['created'])
     bundle.data['informal_modified'] = calculate_informal_time(bundle.data['modified'])
     
     if bundle.data.has_key('body'):
         bundle.data['body_snippet'] = derive_snippet(bundle.data['body'])
     
     # Lookup the user's info
     bundle = get_contributors_info(bundle)
     
     return bundle
Beispiel #2
0
    def dehydrate(self, bundle):
        """ Dehydrate to calc stuff on its way out """

        # Class will always have a created/modified due to default.
        bundle.data["informal_created"] = calculate_informal_time(bundle.data["created"])
        bundle.data["informal_modified"] = calculate_informal_time(bundle.data["modified"])

        if bundle.data.has_key("body"):
            bundle.data["body_snippet"] = derive_snippet(bundle.data["body"])

        # Lookup the user's info
        bundle = get_contributors_info(bundle)

        return bundle
Beispiel #3
0
 def dehydrate(self, bundle):
     """ Dehydrate - data on its way back to requester """
     
     # Class will always have a time_stamp due to default.
     bundle.data['informal_created'] = calculate_informal_time(bundle.data['created'])
     bundle.data['informal_modified'] = calculate_informal_time(bundle.data['modified'])
     
     # Get the useful protective marking elements
     bundle = get_top_level_pm_elements(bundle)
            
     # Lookup the user's info
     bundle = get_contributors_info(bundle)
     
     return bundle
Beispiel #4
0
    def dehydrate(self, bundle):
        """ Dehydrate - data on its way back to requester """

        # User gets passed through because CustomAuth now passes it even for GET requests
        bundle.data["user_voted"] = get_user_vote_status(bundle)

        # Class will always have a time_stamp due to default.
        bundle.data["informal_created"] = calculate_informal_time(bundle.data["created"])
        bundle.data["informal_modified"] = calculate_informal_time(bundle.data["modified"])

        # Get the useful protective marking elements
        bundle = get_top_level_pm_elements(bundle)

        # Lookup the user's info
        bundle = get_contributors_info(bundle)

        # Produce a truncated (by word), html-tag cleaned version
        if bundle.data.has_key("description"):
            bundle.data["description_snippet"] = derive_snippet(bundle.data["description"])

        return bundle