diff options
author | Walter Bender <walter@sugarlabs.org> | 2014-02-10 15:35:51 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2014-02-10 15:35:51 (GMT) |
commit | 5922cb5aad5e84c86a70d5d2bc87740542d4a744 (patch) | |
tree | 19f9f29e7d0c7896cb24ee87b910edf67aaf71bb /TurtleArt/tablock.py | |
parent | cdf974bbbfe8f4488293885dedf109debda45766 (diff) |
more forgiving type checking in Media
Diffstat (limited to 'TurtleArt/tablock.py')
-rw-r--r-- | TurtleArt/tablock.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index 5f3315a..c257a14 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -43,19 +43,21 @@ class Media(object): ALL_TYPES = ('media', 'audio', 'video', 'descr', 'camera', 'camera1') - def __init__(self, type_, value=None): + def __init__(self, media_type, value=None): """ - type_ --- a string that indicates the kind of media: + media_type --- a string that indicates the kind of media: media --- image audio --- audio file video --- video descr --- Journal description camera, camera1 --- camera snapshot value --- a file path or a reference to a Sugar datastore object """ - if type_ not in Media.ALL_TYPES: + if media_type == 'image': + media_type = 'media' + if media_type not in Media.ALL_TYPES: raise ValueError("Media.type must be one of " + repr(Media.ALL_TYPES)) - self.type = type_ + self.type = media_type self.value = value def __str__(self): |