OpenSlides/openslides/utils/utils.py

13 lines
309 B
Python
Raw Normal View History

2014-04-27 21:01:23 +02:00
import roman
2011-09-02 20:46:24 +02:00
2012-02-09 02:29:38 +01:00
def to_roman(number):
2014-04-27 21:01:23 +02:00
"""
2015-09-16 00:55:27 +02:00
Converts an arabic number within range from 1 to 4999 to the
corresponding roman number. Returns None on error conditions.
2014-04-27 21:01:23 +02:00
"""
try:
return roman.toRoman(number)
except (roman.NotIntegerError, roman.OutOfRangeError):
return None