def reprocess_content(self):
""" Allows re-parsing all content as if it were imported for the first time
but without re-hitting the source, or changing the object ids.
Call when a code change would change the representation in the database
"""
session = self.db
emails = session.query(Email).filter(
Email.source_id == self.id,
).options(joinedload_all(Email.parent))
for email in emails:
#session = self.db
#session.add(email)
blob = email.imported_blob
if not isinstance(blob, native_str):
blob = blob.decode('ascii')
(email_object, dummy, error) = self.parse_email(blob, email)
#session.add(email_object)
session.commit()
#session.remove()
with transaction.manager:
self.thread_mails(emails)
评论列表
文章目录