Fixed bug in gam calendars <CalendarEntity> info events and `gam <UserTypeEntity> info events
Some checks failed
Build and test GAM / build (Win64, build, 10, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 3, linux-aarch64, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, linux-aarch64, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 8, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 9, darwin64-arm64, macos-15) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 2, linux-x86_64, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, linux-x86_64, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 7, darwin64-x86_64, macos-13) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 12, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 13, ubuntu-24.04, 3.12) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled

This commit is contained in:
Ross Scroggs
2025-03-03 17:42:42 -08:00
parent e53f440ed2
commit b3867fba5b
2 changed files with 28 additions and 17 deletions

View File

@@ -1,3 +1,8 @@
7.05.07
Fixed bug in `gam calendars <CalendarEntity> info events` and `gam <UserTypeEntity> info events`
where option `showdayofweek` was not recognized.
7.05.06
Improve message displayed when a command is issued that requires Google Chat Bot setup;

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
"""
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.05.06'
__version__ = '7.05.07'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position
@@ -38938,6 +38938,22 @@ def _setEventRecurrenceTimeZone(cal, calId, body, parameters, i, count):
body['end']['timeZone'] = timeZone
return True
def _getEventDaysOfWeek(event):
for attr in ['start', 'end']:
if attr in event:
if 'date' in event[attr]:
try:
dateTime = datetime.datetime.strptime(event[attr]['date'], YYYYMMDD_FORMAT)
event[attr]['dayOfWeek'] = calendarlib.day_abbr[dateTime.weekday()]
except ValueError:
pass
elif 'dateTime' in event[attr]:
try:
dateTime, _ = iso8601.parse_date(event[attr]['dateTime'])
event[attr]['dayOfWeek'] = calendarlib.day_abbr[dateTime.weekday()]
except (iso8601.ParseError, OverflowError):
pass
def _createCalendarEvents(user, origCal, function, calIds, count, body, parameters):
if parameters['attendees']:
body['attendees'] = parameters.pop('attendees')
@@ -39573,6 +39589,8 @@ def _getCalendarInfoEventOptions(calendarEventEntity):
myarg = getArgument()
if myarg == 'fields':
_getEventFields(fieldsList)
elif myarg == 'showdayofweek':
calendarEventEntity['showDayOfWeek'] = True
else:
FJQC.GetFormatJSON(myarg)
_addEventEntitySelectFields(calendarEventEntity, fieldsList)
@@ -39596,6 +39614,8 @@ def _infoCalendarEvents(origUser, user, origCal, calIds, count, calendarEventEnt
throwReasons=GAPI.CALENDAR_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.DELETED, GAPI.FORBIDDEN],
calendarId=calId, eventId=eventId, fields=fields)
if calendarEventEntity['maxinstances'] == -1 or 'recurrence' not in event:
if calendarEventEntity['showDayOfWeek']:
_getEventDaysOfWeek(event)
_showCalendarEvent(user, calId, Ent.EVENT, event, j, jcount, FJQC)
else:
instances = callGAPIpages(cal.events(), 'instances', 'items',
@@ -39609,6 +39629,8 @@ def _infoCalendarEvents(origUser, user, origCal, calIds, count, calendarEventEnt
l = 0
for instance in instances:
l += 1
if calendarEventEntity['showDayOfWeek']:
_getEventDaysOfWeek(instance)
_showCalendarEvent(user, calId, Ent.INSTANCE, instance, l, lcount, FJQC)
Ind.Decrement()
except (GAPI.notFound, GAPI.deleted) as e:
@@ -39662,22 +39684,6 @@ def _getCalendarPrintShowEventOptions(calendarEventEntity, entityType):
_addEventEntitySelectFields(calendarEventEntity, fieldsList)
return (csvPF, FJQC, fieldsList)
def _getEventDaysOfWeek(event):
for attr in ['start', 'end']:
if attr in event:
if 'date' in event[attr]:
try:
dateTime = datetime.datetime.strptime(event[attr]['date'], YYYYMMDD_FORMAT)
event[attr]['dayOfWeek'] = calendarlib.day_abbr[dateTime.weekday()]
except ValueError:
pass
elif 'dateTime' in event[attr]:
try:
dateTime, _ = iso8601.parse_date(event[attr]['dateTime'])
event[attr]['dayOfWeek'] = calendarlib.day_abbr[dateTime.weekday()]
except (iso8601.ParseError, OverflowError):
pass
# gam calendars <CalendarEntity> print events <EventEntity> <EventDisplayProperties>*
# [fields <EventFieldNameList>] [showdayofweek]
# [countsonly] [formatjson [quotechar <Character>]] [todrive <ToDriveAttribute>*]