@contextmanager<EOL><INDENT>def _process_files(self, record_id, data):<DEDENT>
if self.files:<EOL><INDENT>assert not self.files.bucket.locked<EOL>self.files.bucket.locked = True<EOL>snapshot = self.files.bucket.snapshot(lock=True)<EOL>data['<STR_LIT>'] = self.files.dumps(bucket=snapshot.id)<EOL>yield data<EOL>db.session.add(RecordsBuckets(<EOL>record_id=record_id, bucket_id=snapshot.id<EOL>))<EOL><DEDENT>else:<EOL><INDENT>yield data<EOL><DEDENT>
Snapshot bucket and add files in record during first publishing.