コード例 #1
0
def delete_obj(obj):
    """
    Deletes any arbitrary object from the SQLAlchemy Session and cascades deletes to evaluations.

    :param obj: object to delete

    """
    Session.delete(obj)
    Session.flush()
    Session.commit()
コード例 #2
0
ファイル: helpers.py プロジェクト: inpho/inphosite
def delete_obj(obj):
    """
    Deletes any arbitrary object from the SQLAlchemy Session and cascades deletes to evaluations.

    :param obj: object to delete

    """
    Session.delete(obj)
    Session.flush()
    Session.commit()
コード例 #3
0
ファイル: entity.py プロジェクト: inpho/inphosite
    def _delete_date(self, id, id2):
        c.entity = h.fetch_obj(Entity, id, new_id=True)
        # get the date object
        date = self._get_date(id, id2)

        if date in c.entity.dates:
            idx = c.entity.dates.index(date)
            Session.delete(c.entity.dates[idx])
            Session.commit()

        return "OK"
コード例 #4
0
    def _delete_date(self, id, id2):
        c.entity = h.fetch_obj(Entity, id, new_id=True)
        # get the date object
        date = self._get_date(id, id2)

        if date in c.entity.dates:
            idx = c.entity.dates.index(date)
            Session.delete(c.entity.dates[idx])
            Session.commit()
        
        return "OK"
コード例 #5
0
ファイル: entity.py プロジェクト: inpho/inphosite
    def _delete_searchpatterns(self, id):
        c.entity = h.fetch_obj(Entity, id, new_id=True)

        # add a new search pattern
        pattern = request.params.get("pattern", None)
        if pattern is None:
            abort(400)

        pattern = pattern.strip()

        # Boneheaded working around bogus associationproxy in SQLAlchemy 0.6.8
        # Why this isn't just c.entity.searchpatterns.remove(pattern)? who knows
        for spattern in c.entity._spatterns:
            if spattern.searchpattern == pattern:
                Session.delete(spattern)

        Session.commit()

        return "OK"
コード例 #6
0
    def _delete_searchpatterns(self, id):
        c.entity = h.fetch_obj(Entity, id, new_id=True)

        # add a new search pattern
        pattern = request.params.get('pattern', None)
        if pattern is None:
            abort(400)

        pattern = pattern.strip()

        # Boneheaded working around bogus associationproxy in SQLAlchemy 0.6.8
        # Why this isn't just c.entity.searchpatterns.remove(pattern)? who knows
        for spattern in c.entity._spatterns:
            if spattern.searchpattern == pattern:
                Session.delete(spattern)

        Session.commit()

        return "OK"