diff options
author | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2012-12-12 14:08:38 +0100 |
---|---|---|
committer | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2013-01-16 20:19:25 +0100 |
commit | bd6fe9774693a241e99138c987f71b80d968bdc3 (patch) | |
tree | 1e17b4ca9435803e0ecafc695f8fe7c7b6fe692a /mediagoblin/workbench.py | |
parent | 45ab3e07ef26199572207f5d826e6d912eb5b336 (diff) | |
download | mediagoblin-bd6fe9774693a241e99138c987f71b80d968bdc3.tar.lz mediagoblin-bd6fe9774693a241e99138c987f71b80d968bdc3.tar.xz mediagoblin-bd6fe9774693a241e99138c987f71b80d968bdc3.zip |
Shorten Workbench(Manager) method names
1) destroy_self() is a horrible function name, make it "destroy".
workbench.destroy() is descriptive enough.
2) WorkbenchManager.create_workbench() -> WorkbenchManager.create()
We use the pattern "with workbench_manager.create() as workbench:"
No need to mention workbenches three times in a row...
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Diffstat (limited to 'mediagoblin/workbench.py')
-rw-r--r-- | mediagoblin/workbench.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mediagoblin/workbench.py b/mediagoblin/workbench.py index bf18b6cd..0d4db52b 100644 --- a/mediagoblin/workbench.py +++ b/mediagoblin/workbench.py @@ -119,7 +119,7 @@ class Workbench(object): return full_dest_filename - def destroy_self(self): + def destroy(self): """ Destroy this workbench! Deletes the directory and all its contents! @@ -136,7 +136,7 @@ class Workbench(object): def __exit__(self, *args): """Clean up context manager, aka ourselves, deleting the workbench""" - self.destroy_self() + self.destroy() class WorkbenchManager(object): @@ -147,7 +147,7 @@ class WorkbenchManager(object): storage space for during the processing stage. The preferred way to create them is to use: - with workbenchmger.create_workbench as workbench: + with workbenchmger.create() as workbench: do stuff... This will automatically clean up all temporary directories even in @@ -161,7 +161,7 @@ class WorkbenchManager(object): if not os.path.exists(self.base_workbench_dir): os.makedirs(self.base_workbench_dir) - def create_workbench(self): + def create(self): """ Create and return the path to a new workbench (directory). """ |