0

re-arranged config docs, relaxed validator for north direction

This commit is contained in:
Andrew Brown
2012-02-15 19:18:51 -05:00
parent 6b449da966
commit 9c0a8c01ee
3 changed files with 109 additions and 74 deletions

View File

@@ -49,11 +49,12 @@ def validateNorthDirection(direction):
intdir = 0 #default
if type(direction) == int:
intdir = direction
else:
if direction == "upper-left": intdir = UPPER_LEFT
if direction == "upper-right": intdir = UPPER_RIGHT
if direction == "lower-right": intdir = LOWER_RIGHT
if direction == "lower-left": intdir = LOWER_LEFT
elif isinstance(direction, str):
direction = direction.lower().replace("-","").replace("_","")
if direction == "upperleft": intdir = UPPER_LEFT
if direction == "upperright": intdir = UPPER_RIGHT
if direction == "lowerright": intdir = LOWER_RIGHT
if direction == "lowerleft": intdir = LOWER_LEFT
if intdir < 0 or intdir > 3:
raise ValidationException("%r is not a valid north direction" % direction)
return intdir