Your way of validating ascii strings actually includes characters like é from the extended-ascii set (128-255), which I'm pretty sure aren't valid in EC2 names.
You should probably do something like this instead:
import string
def validate_ascii(val):
# ... your stuff here.
for c in val:
if not c in string.printable:
return False
It's either that or something like:
def validate_ascii(val):
# ... your stuff here.
for c in val:
ord_c = ord(c)
# Only chars in the ASCII printable range
if ord_c < 32 or ord_c > 127:
return False
As for the tests, I suggested that you use ec2.web instead of just web or ec2_web doing:
from nova.api import ec2
from nova.api.ec2 import web
Then you can use it with:
ec2.web.Authorizer(...)
Also, your DEFAULT_VALIDATORS should really be a dict instead of a list of tuples. You can iterate across them in the same way you're using it with DEFAULT_VALIDATORS.items().
Hi Matthew,
Your way of validating ascii strings actually includes characters like é from the extended-ascii set (128-255), which I'm pretty sure aren't valid in EC2 names.
You should probably do something like this instead:
import string
def validate_ ascii(val) :
# ... your stuff here.
for c in val:
if not c in string.printable:
return False
It's either that or something like:
def validate_ ascii(val) :
# ... your stuff here.
for c in val:
ord_c = ord(c)
# Only chars in the ASCII printable range
if ord_c < 32 or ord_c > 127:
return False
As for the tests, I suggested that you use ec2.web instead of just web or ec2_web doing:
from nova.api import ec2
from nova.api.ec2 import web
Then you can use it with:
ec2.web. Authorizer( ...)
Also, your DEFAULT_VALIDATORS should really be a dict instead of a list of tuples. You can iterate across them in the same way you're using it with DEFAULT_ VALIDATORS. items() .