From: W. Trevor King Date: Mon, 31 Aug 2009 15:50:28 +0000 (-0400) Subject: Made get_path() definitions consistent between bugdirs, bugs, and comments. X-Git-Tag: 1.0.0~62^2~25^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=baa45573a54bf8f7fdcd7fc53d13f9f160954da7;p=be.git Made get_path() definitions consistent between bugdirs, bugs, and comments. --- diff --git a/.be/bugs/764b812f-a0bb-4f4d-8e2f-c255c9474a0e/values b/.be/bugs/764b812f-a0bb-4f4d-8e2f-c255c9474a0e/values new file mode 100644 index 0000000..631d1d6 --- /dev/null +++ b/.be/bugs/764b812f-a0bb-4f4d-8e2f-c255c9474a0e/values @@ -0,0 +1,17 @@ +creator: W. Trevor King + + +reporter: W. Trevor King + + +severity: minor + + +status: open + + +summary: Add docstrings explaining role of the libbe submodules. + + +time: Mon, 31 Aug 2009 13:57:54 +0000 + diff --git a/libbe/bug.py b/libbe/bug.py index 7554318..f7a1a06 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -341,12 +341,12 @@ class Bug(settings_object.SavedSettingsObject): # methods for saving/loading/acessing settings and properties. - def get_path(self, name=None): - my_dir = os.path.join(self.bugdir.get_path("bugs"), self.uuid) - if name is None: - return my_dir - assert name in ["values", "comments"] - return os.path.join(my_dir, name) + def get_path(self, *args): + dir = os.path.join(self.bugdir.get_path("bugs"), self.uuid) + if len(args) == 0: + return dir + assert args[0] in ["values", "comments"], str(args) + return os.path.join(dir, *args) def set_sync_with_disk(self, value): self.sync_with_disk = value diff --git a/libbe/bugdir.py b/libbe/bugdir.py index ee6c943..64fea1f 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -370,11 +370,11 @@ settings easy. Don't set this attribute. Set .rcs instead, and """ Return a path relative to .root. """ - my_dir = os.path.join(self.root, ".be") + dir = os.path.join(self.root, ".be") if len(args) == 0: - return my_dir + return dir assert args[0] in ["version", "settings", "bugs"], str(args) - return os.path.join(my_dir, *args) + return os.path.join(dir, *args) def _get_settings(self, settings_path, for_duplicate_bugdir=False): allow_no_rcs = not self.rcs.path_in_root(settings_path) diff --git a/libbe/comment.py b/libbe/comment.py index b2fc556..4e55c90 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -546,12 +546,12 @@ class Comment(Tree, settings_object.SavedSettingsObject): # methods for saving/loading/acessing settings and properties. - def get_path(self, name=None): - my_dir = os.path.join(self.bug.get_path("comments"), self.uuid) - if name is None: - return my_dir - assert name in ["values", "body"] - return os.path.join(my_dir, name) + def get_path(self, *args): + dir = os.path.join(self.bug.get_path("comments"), self.uuid) + if len(args) == 0: + return dir + assert args[0] in ["values", "body"], str(args) + return os.path.join(dir, *args) def set_sync_with_disk(self, value): self.sync_with_disk = value