Commit 677f3bab authored by Denis Bilenko's avatar Denis Bilenko

core.ppyx: make _flags_to_int() handle comma-separated strings

parent 3444f110
...@@ -145,16 +145,16 @@ else: ...@@ -145,16 +145,16 @@ else:
cpdef unsigned int _flags_to_int(object flags) except? -1: cpdef unsigned int _flags_to_int(object flags) except? -1:
# Note, that order does not matter, libev has its own predefined order # Note, that order does not matter, libev has its own predefined order
if flags is None: if not flags:
return 0 return 0
if isinstance(flags, (int, long)): if isinstance(flags, (int, long)):
return flags return flags
cdef unsigned int result = 0 cdef unsigned int result = 0
try: try:
if isinstance(flags, basestring): if isinstance(flags, basestring):
return _flags_str2int[flags.lower()] flags = flags.split(',')
for value in flags: for value in flags:
result |= _flags_str2int[value.lower()] result |= _flags_str2int[value.strip().lower()]
except KeyError, ex: except KeyError, ex:
raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys()))))
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment