mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 09:51:36 +00:00
More fixes
This commit is contained in:
10
src/gam.py
10
src/gam.py
@@ -1109,7 +1109,7 @@ def showReport():
|
||||
rep = buildGAPIObject('reports')
|
||||
report = sys.argv[2].lower()
|
||||
report = REPORT_CHOICE_MAP.get(report.replace('_', ''), report)
|
||||
valid_apps = _getEnumValuesMinusUnspecified(rep._rootDesc['resources']['activities']['methods']['list']['parameters']['applicationName']['enum'])+['customer', 'user']
|
||||
valid_apps = gapi.get_enum_values_minus_unspecified(rep._rootDesc['resources']['activities']['methods']['list']['parameters']['applicationName']['enum'])+['customer', 'user']
|
||||
if report not in valid_apps:
|
||||
controlflow.expected_argument_exit("report", ", ".join(sorted(valid_apps)), report)
|
||||
customerId = GC_Values[GC_CUSTOMER_ID]
|
||||
@@ -1556,13 +1556,13 @@ def getCourseAttribute(myarg, value, body, croom, function):
|
||||
elif myarg in ['owner', 'ownerid', 'teacher']:
|
||||
body['ownerId'] = normalizeEmailAddressOrUID(value)
|
||||
elif myarg in ['state', 'status']:
|
||||
validStates = _getEnumValuesMinusUnspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum'])
|
||||
validStates = gapi.get_enum_values_minus_unspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum'])
|
||||
body['courseState'] = _getValidatedState(value, validStates)
|
||||
else:
|
||||
controlflow.invalid_argument_exit(myarg, f"gam {function} course")
|
||||
|
||||
def _getCourseStates(croom, value, courseStates):
|
||||
validStates = _getEnumValuesMinusUnspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum'])
|
||||
validStates = gapi.get_enum_values_minus_unspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum'])
|
||||
for state in value.replace(',', ' ').split():
|
||||
courseStates.append(_getValidatedState(state, validStates))
|
||||
|
||||
@@ -7149,7 +7149,7 @@ def doCreateOrRotateServiceAccountKeys(iam=None, project_id=None, client_email=N
|
||||
myarg = sys.argv[i].lower().replace('_', '')
|
||||
if myarg == 'algorithm':
|
||||
body['keyAlgorithm'] = sys.argv[i+1].upper()
|
||||
allowed_algorithms = _getEnumValuesMinusUnspecified(iam._rootDesc['schemas']['CreateServiceAccountKeyRequest']['properties']['keyAlgorithm']['enum'])
|
||||
allowed_algorithms = gapi.get_enum_values_minus_unspecified(iam._rootDesc['schemas']['CreateServiceAccountKeyRequest']['properties']['keyAlgorithm']['enum'])
|
||||
if body['keyAlgorithm'] not in allowed_algorithms:
|
||||
controlflow.expected_argument_exit("algorithm", ", ".join(allowed_algorithms), body['keyAlgorithm'])
|
||||
local_key_size = 0
|
||||
@@ -10033,7 +10033,7 @@ def doPrintShowAlertFeedback():
|
||||
|
||||
def doCreateAlertFeedback():
|
||||
_, ac = buildAlertCenterGAPIObject(_getValueFromOAuth('email'))
|
||||
valid_types = _getEnumValuesMinusUnspecified(ac._rootDesc['schemas']['AlertFeedback']['properties']['type']['enum'])
|
||||
valid_types = gapi.get_enum_values_minus_unspecified(ac._rootDesc['schemas']['AlertFeedback']['properties']['type']['enum'])
|
||||
alertId = sys.argv[3]
|
||||
body = {'type': sys.argv[4].upper()}
|
||||
if body['type'] not in valid_types:
|
||||
|
||||
@@ -152,16 +152,16 @@ def printEvents():
|
||||
showHiddenInvitations = True
|
||||
i += 1
|
||||
elif myarg == 'after':
|
||||
timeMin = __main__.getTimeOrDeltaFromNow(sys.argv[i+1])
|
||||
timeMin = utils.get_time_or_delta_from_now(sys.argv[i+1])
|
||||
i += 2
|
||||
elif myarg == 'before':
|
||||
timeMax = __main__.getTimeOrDeltaFromNow(sys.argv[i+1])
|
||||
timeMax = utils.get_time_or_delta_from_now(sys.argv[i+1])
|
||||
i += 2
|
||||
elif myarg == 'timezone':
|
||||
timeZone = sys.argv[i+1]
|
||||
i += 2
|
||||
elif myarg == 'updated':
|
||||
updatedMin = __main__.getTimeOrDeltaFromNow(sys.argv[i+1])
|
||||
updatedMin = utils.get_time_or_delta_from_now(sys.argv[i+1])
|
||||
i += 2
|
||||
elif myarg == 'todrive':
|
||||
toDrive = True
|
||||
@@ -312,14 +312,14 @@ def getEventAttributes(i, cal, body, action):
|
||||
body['start'] = {'date': __main__.getYYYYMMDD(sys.argv[i+2])}
|
||||
i += 3
|
||||
else:
|
||||
body['start'] = {'dateTime': __main__.getTimeOrDeltaFromNow(sys.argv[i+1])}
|
||||
body['start'] = {'dateTime': utils.get_time_or_delta_from_now(sys.argv[i+1])}
|
||||
i += 2
|
||||
elif myarg == 'end':
|
||||
if sys.argv[i+1].lower() == 'allday':
|
||||
body['end'] = {'date': getYYYYMMDD(sys.argv[i+2])}
|
||||
i += 3
|
||||
else:
|
||||
body['end'] = {'dateTime': __main__.getTimeOrDeltaFromNow(sys.argv[i+1])}
|
||||
body['end'] = {'dateTime': utils.get_time_or_delta_from_now(sys.argv[i+1])}
|
||||
i += 2
|
||||
elif myarg == 'guestscantinviteothers':
|
||||
body['guestsCanInviteOthers'] = False
|
||||
@@ -457,10 +457,10 @@ def changeAttendees(users):
|
||||
do_it = False
|
||||
i += 1
|
||||
elif myarg == 'start':
|
||||
start_date = __main__.getTimeOrDeltaFromNow(sys.argv[i+1])
|
||||
start_date = utils.get_time_or_delta_from_now(sys.argv[i+1])
|
||||
i += 2
|
||||
elif myarg == 'end':
|
||||
end_date = __main__.getTimeOrDeltaFromNow(sys.argv[i+1])
|
||||
end_date = utils.get_time_or_delta_from_now(sys.argv[i+1])
|
||||
i += 2
|
||||
elif myarg == 'allevents':
|
||||
allevents = True
|
||||
|
||||
@@ -199,7 +199,7 @@ def getExportInfo():
|
||||
|
||||
def createHold():
|
||||
v = buildGAPIObject()
|
||||
allowed_corpuses = v._rootDesc['schemas']['Hold']['properties']['corpus']['enum']
|
||||
allowed_corpuses = gapi.get_enum_values_minus_unspecified(v._rootDesc['schemas']['Hold']['properties']['corpus']['enum'])
|
||||
body = {'query': {}}
|
||||
i = 3
|
||||
query = None
|
||||
|
||||
Reference in New Issue
Block a user