Пример #1
0
 def remove(self, obj):
     try:
         db_session.delete(obj)
         db_session.commit()
         return obj
     except Exception:
         db_session.rollback()
         return 'fail'
Пример #2
0
 def remove(self, obj):
     try:
         documentoLinks = dls.findByLinkId(obj.id)
         for dl in documentoLinks:
             dls.remove(dl)
         db_session.delete(obj)
         db_session.commit()
         return obj
     except Exception:
         db_session.rollback()
         return obj
Пример #3
0
 def remove(self, obj):
     try:
         links = Link.query.filter_by(host_id=obj.id).all()
         for link in links:
             doclinks = DocumentoLink.query.filter_by(link_id=link.id).all()
             for doclink in doclinks:
                 db_session.delete(doclink)
             db_session.delete(link)
         db_session.delete(obj)
         db_session.commit()
         return obj
     except Exception:
         db_session.rollback()
         return 'fail'
Пример #4
0
 def remove(self, obj):
     try:
         doclinks = DocumentoLink.query.filter_by(documento_id=obj.id).all()
         for doc in doclinks:
             db_session.delete(doc)
         indInv = IndiceInvertido.query.filter_by(documento_id=obj.id).all()
         for ind in indInv:
             db_session.delete(ind)
         db_session.delete(obj)
         db_session.commit()
         return obj
     except Exception:
         db_session.rollback()
         return 'fail'