Revision d47565d8 snf-pithos-backend/pithos/backends/modular.py
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
124 | 124 |
logger = logging.getLogger(__name__) |
125 | 125 |
|
126 | 126 |
|
127 |
def backend_method(func): |
|
128 |
@wraps(func) |
|
129 |
def wrapper(self, *args, **kw): |
|
130 |
self.success_status = getattr(self, 'success_status', False) |
|
131 |
try: |
|
132 |
result = func(self, *args, **kw) |
|
133 |
return result |
|
134 |
except: |
|
135 |
self.backend.success_status = False |
|
136 |
raise |
|
137 |
return wrapper |
|
138 |
|
|
139 |
|
|
140 | 127 |
def debug_method(func): |
141 | 128 |
@wraps(func) |
142 | 129 |
def wrapper(self, *args, **kw): |
... | ... | |
268 | 255 |
|
269 | 256 |
self.lock_container_path = False |
270 | 257 |
|
271 |
def __enter__(self): |
|
258 |
def pre_exec(self, lock_container_path=False): |
|
259 |
self.lock_container_path = lock_container_path |
|
272 | 260 |
self.wrapper.execute() |
273 |
return self |
|
274 | 261 |
|
275 |
def __exit__(self, type, value, traceback): |
|
276 |
success_status = getattr(self, 'success_status', True) |
|
262 |
def post_exec(self, success_status=True): |
|
277 | 263 |
if success_status: |
278 | 264 |
# send messages produced |
279 | 265 |
for m in self.messages: |
... | ... | |
306 | 292 |
accept_serials=[], |
307 | 293 |
reject_serials=self.serials) |
308 | 294 |
self.wrapper.rollback() |
309 |
self.close() |
|
310 | 295 |
|
311 | 296 |
def close(self): |
312 | 297 |
self.wrapper.close() |
Also available in: Unified diff