Consistent _get_multi_param() function in responses

This abstracts _get_multi_param() into BaseResponse and makes it
always ensure that the string it has been given ends with a '.'.  It
had been implemented in three different places, and in use it rarely
postpended a trailing period, which could make it match parameters it
shouldn't have.
This commit is contained in:
Chris St. Pierre 2014-05-08 10:41:28 -04:00
commit fab37942c4
4 changed files with 10 additions and 16 deletions

View file

@ -8,10 +8,6 @@ from moto.ec2.exceptions import InvalidIdError
class InstanceResponse(BaseResponse):
def _get_multi_param(self, param_prefix):
return [value[0] for key, value in self.querystring.items()
if key.startswith(param_prefix + ".")]
def describe_instances(self):
instance_ids = instance_ids_from_querystring(self.querystring)
if instance_ids: