From d2ffca2cf758ad2446f5db4fcd656ddd7d511ff5 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 31 Jul 2014 13:38:51 -0400 Subject: [PATCH] Remove unneccesary checks for method existence --- .../xmodule/xmodule/modulestore/__init__.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py index 4cb269994a..6cfd36b483 100644 --- a/common/lib/xmodule/xmodule/modulestore/__init__.py +++ b/common/lib/xmodule/xmodule/modulestore/__init__.py @@ -657,14 +657,22 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite): # it's ok if the cached metadata in the memcache is invalid when another # request comes in for the same course. try: - if hasattr(self, '_begin_bulk_write_operation'): - self._begin_bulk_write_operation(course_id) + self._begin_bulk_write_operation(course_id) yield finally: - # check for the begin method here, - # since it's an error if an end method is not defined when a begin method is - if hasattr(self, '_begin_bulk_write_operation'): - self._end_bulk_write_operation(course_id) + self._end_bulk_write_operation(course_id) + + def _begin_bulk_write_operation(self, course_id): + """ + Begin a bulk write operation on course_id. + """ + pass + + def _end_bulk_write_operation(self, course_id): + """ + End the active bulk write operation on course_id. + """ + pass def only_xmodules(identifier, entry_points):