# Path: common_configs/utils.py
# def merge_items(base, new_items):
#     """
#     Merges two lists and eliminates duplicates
# 
#     :type base: list
#     :type new_items: list
#     :rtype: list
#     """
#     for item in new_items:
#         if not item in base:
#             base = base + [item]
#     return base


from configurations import values
from ..utils import merge_items

from __future__ import absolute_import, division, print_function, unicode_literals




class RavenDSNValue(values.SecretValue):

    def __init__(self, *args, **kwargs):
        kwargs.setdefault("environ_prefix", None)
        kwargs.setdefault("environ_name", "SENTRY_DSN")
        super(RavenDSNValue, self).__init__(*args, **kwargs)

    def to_python(self, value):
        return {
            "dsn": super(RavenDSNValue, self).to_python(value)
        }


class Raven(object):

    #: Reads Raven connection settings from ``SENTRY_DSN`` environment variable
    RAVEN_CONFIG = RavenDSNValue()

    @property
    def MIDDLEWARE_CLASSES(self):
        """
        Appends :class:`raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware`
        to list of ``MIDDLEWARE_CLASSES``.
        """

# Path: common_configs/utils.py
# def merge_items(base, new_items):
#     """
#     Merges two lists and eliminates duplicates
# 
#     :type base: list
#     :type new_items: list
#     :rtype: list
#     """
#     for item in new_items:
#         if not item in base:
#             base = base + [item]
#     return base


# Path: common_configs/services/sentry.py
from configurations import values
from ..utils import merge_items


from __future__ import absolute_import, division, print_function, unicode_literals




class RavenDSNValue(values.SecretValue):

    def __init__(self, *args, **kwargs):
        kwargs.setdefault("environ_prefix", None)
        kwargs.setdefault("environ_name", "SENTRY_DSN")
        super(RavenDSNValue, self).__init__(*args, **kwargs)

    def to_python(self, value):
        return {
            "dsn": super(RavenDSNValue, self).to_python(value)
        }


class Raven(object):

    #: Reads Raven connection settings from ``SENTRY_DSN`` environment variable
    RAVEN_CONFIG = RavenDSNValue()

    @property
    def MIDDLEWARE_CLASSES(self):
        """
        Appends :class:`raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware`
        to list of ``MIDDLEWARE_CLASSES``.
        """

        return merge_items(super(Raven, self).MIDDLEWARE_CLASSES, [