コード例 #1
0
ファイル: middleware.py プロジェクト: hanleybrand/mdid_dj16
    def __init__(self):

        try:
            # Add missing index on object_id on AccessControl table
            creation = BaseDatabaseCreation(connection)
            sql = creation.sql_indexes_for_field(
                AccessControl,
                AccessControl._meta.get_field('object_id'),
                no_style(),
            )
            cursor = connection.cursor()
            for s in sql:
                cursor.execute(s)
        except:
            pass

        try:
            # Remove IP based group members
            for group in ExtendedGroup.objects.filter(type=IP_BASED_GROUP):
                group.user_set.all().delete()
        except:
            pass

        # Only need to run once
        raise MiddlewareNotUsed
コード例 #2
0
ファイル: middleware.py プロジェクト: WMInfoTech/rooibos
    def __init__(self):

        try:
            # Add missing index on object_id on AccessControl table
            creation = BaseDatabaseCreation(connection)
            sql = creation.sql_indexes_for_field(
                AccessControl,
                AccessControl._meta.get_field('object_id'),
                no_style(),
            )
            cursor = connection.cursor()
            for s in sql:
                logging.debug("running query %s" % s)
                cursor.execute(s)
                logging.debug("done")
        except:
            logging.exception("error running query")
            #pass

        try:
            # Remove IP based group members
            for group in ExtendedGroup.objects.filter(type=IP_BASED_GROUP):
                logging.debug("deleting users from group %s" % group.id)
                group.user_set.clear()
                logging.debug("done")
        except:
            logging.exception("error deleting users")
            #pass

        # Only need to run once
        raise MiddlewareNotUsed
コード例 #3
0
    def __init__(self):

        try:
            # Add missing index on object_id on AccessControl table
            creation = BaseDatabaseCreation(connection)
            sql = creation.sql_indexes_for_field(
                AccessControl,
                AccessControl._meta.get_field('object_id'),
                no_style(),
            )
            cursor = connection.cursor()
            for s in sql:
                logging.debug("running query %s" % s)
                cursor.execute(s)
                logging.debug("done")
        except:
            logging.exception("error running query")
            #pass

        try:
            # Remove IP based group members
            for group in ExtendedGroup.objects.filter(type=IP_BASED_GROUP):
                logging.debug("deleting users from group %s" % group.id)
                group.user_set.clear()
                logging.debug("done")
        except:
            logging.exception("error deleting users")
            #pass

        # Only need to run once
        raise MiddlewareNotUsed
コード例 #4
0
ファイル: middleware.py プロジェクト: hanleybrand/vic-mdid
    def __init__(self):

        try:
            # Add missing index on object_id on AccessControl table
            creation = BaseDatabaseCreation(connection)
            sql = creation.sql_indexes_for_field(
                AccessControl,
                AccessControl._meta.get_field('object_id'),
                no_style(),
            )
            cursor = connection.cursor()
            for s in sql:
                cursor.execute(s)
        except:
            pass

        # Only need to run once
        raise MiddlewareNotUsed
コード例 #5
0
ファイル: middleware.py プロジェクト: Blanko2/vic-mdid
    def __init__(self):

        try:
            # Add missing index on object_id on AccessControl table
            creation = BaseDatabaseCreation(connection)
            sql = creation.sql_indexes_for_field(
                AccessControl,
                AccessControl._meta.get_field('object_id'),
                no_style(),
            )
            cursor = connection.cursor()
            for s in sql:
                cursor.execute(s)
        except:
            pass

        # Only need to run once
        raise MiddlewareNotUsed