Skip to content

Commit

Permalink
Tidy legacy support for scale_factors, tile_width, tile_height
Browse files Browse the repository at this point in the history
  • Loading branch information
zimeon committed May 18, 2016
1 parent 8a5352f commit 90d0d09
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions iiif/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,6 @@ def as_json(self, validate=True):
Will raise IIIFInfoError if insufficient parameters are present to
have a valid info.json response (unless validate is False).
"""
if (self.api_version >= '2.0' and not self.tiles and
self.tile_width and self.scale_factors):
# make 2.0 tiles data from 1.1 like data
self.tiles = [{'width': int(self.tile_width), # FIXME - int() is fudge, data should be int
'scaleFactors': self.scale_factors}]
if (validate):
self.validate()
json_dict = {}
Expand Down Expand Up @@ -470,17 +465,7 @@ def as_json(self, validate=True):
params_to_write.discard('qualities')
params_to_write.discard('supports')
for param in params_to_write:
# FIXME - Need better way to handle params
if (param == 'scale_factors'):
if (self.scale_factors is not None):
json_dict[param] = self.scale_factors
elif (param == 'tile_width'):
if (self.tile_width is not None):
json_dict[param] = self.tile_width
elif (param == 'tile_height'):
if (self.tile_height is not None):
json_dict[param] = self.tile_height
elif (hasattr(self, param) and
if (hasattr(self, param) and
getattr(self, param) is not None):
json_dict[param] = getattr(self, param)
return(json.dumps(json_dict, sort_keys=True, indent=2))
Expand Down

0 comments on commit 90d0d09

Please sign in to comment.