From 4071607711202b2218ce17d4462214205b4b8399 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 18 Aug 2022 16:28:20 -0400 Subject: [PATCH] 2022-08-18 Fred Gleason * Fixed a bug in PyPAD where resolution of datetimes could be incorrect. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ apis/pypad/api/pypad.py | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c88e30f..bb9ffa67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23236,3 +23236,6 @@ message when processing a 202 response. * Added explicit processing for 201, 230, 401, 402, 403, 409, 431, 432, 433, 434, 501, 502, 503 and 530 returns in the CDDB parser. +2022-08-18 Fred Gleason + * Fixed a bug in PyPAD where resolution of datetimes could be + incorrect. diff --git a/apis/pypad/api/pypad.py b/apis/pypad/api/pypad.py index 3cec995b..f5a6f16c 100644 --- a/apis/pypad/api/pypad.py +++ b/apis/pypad/api/pypad.py @@ -2,7 +2,7 @@ # # PAD processor for Rivendell # -# (C) Copyright 2018-2021 Fred Gleason +# (C) Copyright 2018-2022 Fred Gleason # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -188,18 +188,22 @@ class Update(object): # # Process Dates # - dt_pattern=dt_pattern.replace('MMMM',dt.strftime('%B')) - dt_pattern=dt_pattern.replace('MMM',dt.strftime('%b')) + dt_pattern=dt_pattern.replace('MMMM',dt.strftime('%B').upper()) + dt_pattern=dt_pattern.replace('MMM',dt.strftime('%b').upper()) dt_pattern=dt_pattern.replace('MM',dt.strftime('%m')) dt_pattern=dt_pattern.replace('M',str(dt.month)) - dt_pattern=dt_pattern.replace('dddd',dt.strftime('%A')) - dt_pattern=dt_pattern.replace('ddd',dt.strftime('%a')) + dt_pattern=dt_pattern.replace('dddd',dt.strftime('%A').upper()) + dt_pattern=dt_pattern.replace('ddd',dt.strftime('%a').upper()) dt_pattern=dt_pattern.replace('dd',dt.strftime('%d')) dt_pattern=dt_pattern.replace('d',str(dt.day)) dt_pattern=dt_pattern.replace('yyyy',dt.strftime('%Y')) dt_pattern=dt_pattern.replace('yy',dt.strftime('%y')) + pat='' + for s in dt_pattern.split(" "): + pat+=s.capitalize()+' ' + dt_pattern=pat[:-1] except AttributeError: string=string.replace(pattern,'') @@ -751,8 +755,6 @@ class Update(object): result=result and False else: result=result and False - #print('machine(): '+str(self.machine())) - #print('result: '+str(result)) return result