comparison roundup/rest.py @ 5687:83037aaf3b9d

Move definition/initialization of api_version into the class and out of dispatch. Tests were failing because of this since the tests don't all run through dispatch.
author John Rouillard <rouilj@ieee.org>
date Sun, 31 Mar 2019 22:36:41 -0400
parents eb51c0d9c9bf
children 2c516d113620
comparison
equal deleted inserted replaced
5686:eb51c0d9c9bf 5687:83037aaf3b9d
324 } 324 }
325 __default_accept_type = "json" 325 __default_accept_type = "json"
326 326
327 __default_api_version = 1 327 __default_api_version = 1
328 __supported_api_versions = [ 1 ] 328 __supported_api_versions = [ 1 ]
329
330
331 api_version = None
329 332
330 def __init__(self, client, db): 333 def __init__(self, client, db):
331 self.client = client 334 self.client = client
332 self.db = db 335 self.db = db
333 self.translator = client.translator 336 self.translator = client.translator
1448 uri) 1451 uri)
1449 1452
1450 # parse Accept header and get the content type 1453 # parse Accept header and get the content type
1451 accept_header = parse_accept_header(headers.get('Accept')) 1454 accept_header = parse_accept_header(headers.get('Accept'))
1452 accept_type = "invalid" 1455 accept_type = "invalid"
1453 self.api_version = None
1454 for part in accept_header: 1456 for part in accept_header:
1455 if part[0] in self.__accepted_content_type: 1457 if part[0] in self.__accepted_content_type:
1456 accept_type = self.__accepted_content_type[part[0]] 1458 accept_type = self.__accepted_content_type[part[0]]
1457 # Version order: 1459 # Version order:
1458 # 1) accept header version=X specifier 1460 # 1) accept header version=X specifier

Roundup Issue Tracker: http://roundup-tracker.org/