def _parsePageToken(pageToken, numValues): """ Parses the specified pageToken and returns a list of the specified number of values. Page tokens are assumed to consist of a fixed number of integers seperated by colons. If the page token does not conform to this specification, raise a InvalidPageToken exception. """ tokens = pageToken.split(":") if len(tokens) != numValues: msg = "Invalid number of values in page token" raise exceptions.BadPageTokenException(msg) try: values = map(int, tokens) except ValueError: msg = "Malformed integers in page token" raise exceptions.BadPageTokenException(msg) return values
def _raiseBadPageTokenException(self): raise exceptions.BadPageTokenException( self._badPageTokenExceptionMessage)