Skip to content

Conversation

@shinchris
Copy link
Contributor

Max_age query parameter was recently added to the REST API endpoints for query view data/pdf and query workbook pdf. This PR adds max_age param to the csv and pdf request options.
It was already in place for view images.

Will make doc updates separately for that branch.

params.append('orientation={0}'.format(self.orientation))

if self.max_age:
params.append('maxAge={0}'.format(self.max_age))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do some verification that this is an integer at least?

Landscape = "landscape"

def __init__(self, page_type=None, orientation=None):
def __init__(self, page_type=None, orientation=None, maxage=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call it max_age here as well since it’s what you call it on the object anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImageRequestOptions already had maxage, so I wanted to keep it consistent across the 3 request objects without introducing any breaking changes. I guess we could deprecate it if we really wanted to change it?

@shinchris
Copy link
Contributor Author

oops i made the change in a different branch.

try:
return int(value)
except ValueError:
print("Integer value expected for the '{}' parameter, but got {}".format(name, value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to just print something in this case. We should throw an exception that tells what the error is. I believe we have something for Integer parameter errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have property decorators in models for Integer parameter errors, but didn't want to bring that into here.
Above snippet prints a message and re-throws the same ValueError. It would be ideal to throw an exception with our custom message, but that results in 2 exceptions being thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants