diff -r 21468682f688 -r d7f5d873e1b8 server/sources/storages.py --- a/server/sources/storages.py Wed Oct 06 11:57:21 2010 +0200 +++ b/server/sources/storages.py Wed Oct 06 14:04:26 2010 +0200 @@ -18,6 +18,7 @@ """custom storages for the system source""" from os import unlink, path as osp +from contextlib import contextmanager from yams.schema import role_name @@ -96,6 +97,17 @@ return path return None +@contextmanager +def fsimport(session): + present = 'fs_importing' in session.transaction_data + old_value = session.transaction_data.get('fs_importing') + session.transaction_data['fs_importing'] = True + yield + if present: + session.transaction_data['fs_importing'] = old_value + else: + del session.transaction_data['fs_importing'] + class BytesFileSystemStorage(Storage): """store Bytes attribute value on the file system"""