@@ -1560,6 +1560,11 @@ def html_format(configuration, ret_val, ret_msg, out_obj):
15601560 single_peer ['state' ] = single_peer .get ('state' , '' )
15611561 if not single_peer ['state' ]:
15621562 single_peer ['state' ] = 'NA'
1563+ single_peer ['expire' ] = single_peer .get ('expire' , '' )
1564+ if single_peer ['expire' ]:
1565+ # Make a dummy input field to force consistent date format
1566+ single_peer ['expire' ] = "<input class='noborder' type=date " + \
1567+ "value='%(expire)s' readonly=readonly />" % single_peer
15631568 lines .append ('''<tr>
15641569<td>%(full_name)s</td><td>%(organization)s</td><td>%(email)s</td>
15651570<td>%(country)s</td><td>%(state)s</td><td>%(kind)s</td><td>%(label)s</td><td>%(expire)s</td>
@@ -1903,7 +1908,7 @@ def html_format(configuration, ret_val, ret_msg, out_obj):
19031908 skip_list = i .get ('skip_list' , [])
19041909 optional_cols = [('access' , 'Access' ), ('created' , 'Created' ),
19051910 ('active' , 'Active' ), ('owner' , 'Owner' ),
1906- ('invites' , 'Invites' ), ('expire' , 'Expire' ),
1911+ ('invites' , 'Invites' ), ('expire' , 'Expire' ),
19071912 ('single_file' , 'Single file' ),
19081913 ]
19091914 # IMPORTANT: AdBlock Plus hides elements with class sharelink(s)
@@ -2749,7 +2754,7 @@ def file_format(configuration, ret_val, ret_msg, out_obj):
27492754 content_type = val
27502755 if content_type in ('text/plain' , 'text/html' ):
27512756 render_text , render_errors = True , True
2752- #_logger.debug("render output in file_format: %s (%s %s)" %
2757+ # _logger.debug("render output in file_format: %s (%s %s)" %
27532758 # (out_obj, render_text, render_errors))
27542759 for entry in out_obj :
27552760 if entry ['object_type' ] == 'file_output' :
@@ -2816,7 +2821,7 @@ def format_output(
28162821 """This is the public method that should be called from other scripts"""
28172822
28182823 logger = configuration .logger
2819- #logger.debug("format output to %s" % outputformat)
2824+ # logger.debug("format output to %s" % outputformat)
28202825 valid_formats = get_valid_outputformats ()
28212826 (val_ret , val_msg ) = validate (out_obj )
28222827 if not val_ret :
@@ -2867,7 +2872,7 @@ def format_output(
28672872 if not outputformat in ('txt' , 'html' , 'file' ):
28682873 out_obj = [i for i in out_obj if i ['object_type' ] != 'wsgi' ]
28692874
2870- #logger.debug("%s formatting output" % outputformat)
2875+ # logger.debug("%s formatting output" % outputformat)
28712876 try :
28722877 # return eval('%s_format(configuration, ret_val, ret_msg, out_obj)' %
28732878 # outputformat)
@@ -2900,10 +2905,10 @@ def format_output(
29002905def format_timedelta (timedelta ):
29012906 """Formats timedelta as '[Years,] [days,] HH:MM:SS'"""
29022907 years = timedelta .days // 365
2903- days = timedelta .days - (years * 365 )
2908+ days = timedelta .days - (years * 365 )
29042909 hours = timedelta .seconds // 3600
2905- minutes = (timedelta .seconds - (hours * 3600 )) // 60
2906- seconds = timedelta .seconds - (hours * 3600 ) - (minutes * 60 )
2910+ minutes = (timedelta .seconds - (hours * 3600 )) // 60
2911+ seconds = timedelta .seconds - (hours * 3600 ) - (minutes * 60 )
29072912
29082913 hours_str = "%s" % hours
29092914 if hours < 10 :
0 commit comments