def convert(self, request, response, data):
        """
        Performs the desired Conversion.

        :param request: The webob Request object describing the
                        request.
        :param response: The webob Response object describing the
                         response.
        :param data: The data dictionary returned by the prepare()
                     method.

        :returns: A string, the results of which are the desired
                  conversion.
        """

        # Determine which time to use
        fmtstr = self.modifier.param
        if fmtstr is None:
            log_time = data['start']
        elif fmtstr == 'begin' or fmtstr.startswith('begin:'):
            log_time = data['start']
            if fmtstr == 'begin':
                fmtstr = None
            else:
                fmtstr = fmtstr[len('begin:'):]
        elif fmtstr == 'end' or fmtstr.startswith('end:'):
            log_time = time.time()
            if fmtstr == 'end':
                fmtstr = None
            else:
                fmtstr = fmtstr[len('end:'):]
        else:
            log_time = data['start']

        # Next, determine the format to use
        if fmtstr is None:
            fmtstr = "[%d/%b/%Y:%H:%M:%S +0000]"
        elif fmtstr in ('sec', 'msec', 'usec', 'msec_frac', 'usec_frac'):
            mult = 1
            fld_len = 0

            # Handle microseconds and milliseconds
            if fmtstr.startswith('usec'):
                mult = 1000000
                fld_len = 6
            elif fmtstr.startswith('msec'):
                mult = 1000
                fld_len = 3

            # Adjust for request for fractions
            if fmtstr.endswith('_frac'):
                log_time = int((log_time * mult) - (int(log_time) * mult))
            else:
                log_time = int(log_time * mult)
                fld_len = 0

            # Return the formatted result
            return "%0*d" % (fld_len, log_time)

        return time.strftime(fmtstr, time.gmtime(log_time))
def convert ( self , request , response , data ) : fmtstr = self . modifier . param if fmtstr is None : log_time = data [ 'start' ] elif fmtstr == 'begin' or fmtstr . startswith ( 'begin:' ) : log_time = data [ 'start' ] if fmtstr == 'begin' : fmtstr = None else : fmtstr = fmtstr [ len ( 'begin:' ) : ] elif fmtstr == 'end' or fmtstr . startswith ( 'end:' ) : log_time = time . time ( ) if fmtstr == 'end' : fmtstr = None else : fmtstr = fmtstr [ len ( 'end:' ) : ] else : log_time = data [ 'start' ] if fmtstr is None : fmtstr = "[%d/%b/%Y:%H:%M:%S +0000]" elif fmtstr in ( 'sec' , 'msec' , 'usec' , 'msec_frac' , 'usec_frac' ) : mult = 1 fld_len = 0 if fmtstr . startswith ( 'usec' ) : mult = 1000000 fld_len = 6 elif fmtstr . startswith ( 'msec' ) : mult = 1000 fld_len = 3 if fmtstr . endswith ( '_frac' ) : log_time = int ( ( log_time * mult ) - ( int ( log_time ) * mult ) ) else : log_time = int ( log_time * mult ) fld_len = 0 return "%0*d" % ( fld_len , log_time ) return time . strftime ( fmtstr , time . gmtime ( log_time ) )
Performs the desired Conversion.

        :param request: The webob Request object describing the
                        request.
        :param response: The webob Response object describing the
                         response.
        :param data: The data dictionary returned by the prepare()
                     method.

        :returns: A string, the results of which are the desired
                  conversion.