Hack Comment.load_settings() to work around From->Author change.
authorW. Trevor King <wking@drexel.edu>
Mon, 27 Jul 2009 10:23:20 +0000 (06:23 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 27 Jul 2009 10:23:20 +0000 (06:23 -0400)
"Author" -> comment.author obeys settings_object.setting_name_to_attr_name(),
but all the current on-disk mapfiles talk about "From".  Add a hack to accept
both forms of on-disk comment files.

libbe/comment.py

index 7b43c081ea8d50baae13a6503bf878babf35fa90..53519bfd57ae982fad43f4cfa350eceab42ed38a 100644 (file)
@@ -557,6 +557,9 @@ class Comment(Tree, settings_object.SavedSettingsObject):
         if self.sync_with_disk == False:
             raise DiskAccessRequired("load settings")
         self.settings = mapfile.map_load(self.rcs, self.get_path("values"))
+        # hack to deal with old BE comments:
+        if "From" in self.settings:
+            self.settings["Author"] = self.settings.pop("From")
         self._setup_saved_settings()
 
     def save_settings(self):