From f93375e0886e88d0881acb237109e9ac3ce26438 Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Tue, 14 Jun 2011 18:58:31 +0200 Subject: [PATCH] handle empty filenames --- sloth/annotations/container.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sloth/annotations/container.py b/sloth/annotations/container.py index 8f5e09a..4a6fb6c 100644 --- a/sloth/annotations/container.py +++ b/sloth/annotations/container.py @@ -75,6 +75,8 @@ class AnnotationContainer: """ Load the annotations. """ + if not filename: + raise InvalidArgumentException("filename cannot be empty") self.annotations_ = self.parseFromFile(filename) self.filename_ = filename @@ -88,10 +90,12 @@ class AnnotationContainer: "AnnotationContainer.load()" ) - def save(self, filename): + def save(self, filename=""): """ Save the annotations. """ + if not filename: + filename = self.filename() self.serializeToFile(filename) self.filename_ = filename