コード例 #1
0
 def __init__(self):
     self.account_number = get_required_setting(
         'KISS_INSIGHTS_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE,
         "must be (a string containing) a number")
     self.site_code = get_required_setting(
         'KISS_INSIGHTS_SITE_CODE', SITE_CODE_RE,
         "must be a string containing three characters")
コード例 #2
0
 def __init__(self):
     self.account_number = get_required_setting(
         'KISS_INSIGHTS_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE,
         "must be (a string containing) a number")
     self.site_code = get_required_setting(
         'KISS_INSIGHTS_SITE_CODE', SITE_CODE_RE,
         "must be a string containing three characters")
コード例 #3
0
 def __init__(self):
     self.property_id = get_required_setting(
             'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE,
             "must be a string looking like 'UA-XXXXXX-Y'")
     self.tracked_domain_name = get_required_setting(
             'GOOGLE_ANALYTICS_TRACKED_DOMAIN', TRACKED_DOMAIN_RE,
             "must be a string ")
コード例 #4
0
    def test_get_required_setting(self):
        """
        Make sure using get_required_setting fails in the right place.
        """

        with self.assertRaisesRegex(AnalyticalException,
                                    "^USER_ID setting is not set$"):
            get_required_setting("USER_ID", r"\d+", "invalid USER_ID")
コード例 #5
0
    def test_get_required_setting(self):
        """
        Make sure using get_required_setting fails in the right place.
        """

        with pytest.raises(AnalyticalException,
                           match="USER_ID setting is not set"):
            get_required_setting("USER_ID", r"\d+", "invalid USER_ID")
コード例 #6
0
 def __init__(self):
     self.tracker_id = get_required_setting('CLICKTALE_PROJECT_ID',
             CLICKTALE_PROJECT_ID_RE,
             "must be a (string containing) a number")
     self.recording_ratio = get_required_setting('CLICKTALE_RECORDING_RATIO',
             CLICKTALE_PROJECT_ID_RE,
             "must be a (string containing) a number")
     self
コード例 #7
0
ファイル: piwik.py プロジェクト: jcassee/django-analytical
 def __init__(self):
     self.domain_path = get_required_setting(
         "PIWIK_DOMAIN_PATH",
         DOMAINPATH_RE,
         "must be a domain name, optionally followed "
         "by an URI path, no trailing slash (e.g. "
         "piwik.example.com or my.piwik.server/path)",
     )
     self.site_id = get_required_setting("PIWIK_SITE_ID", SITEID_RE, "must be a (string containing a) number")
コード例 #8
0
ファイル: matomo.py プロジェクト: jcassee/django-analytical
 def __init__(self):
     self.domain_path = \
         get_required_setting('MATOMO_DOMAIN_PATH', DOMAINPATH_RE,
                              "must be a domain name, optionally followed "
                              "by an URI path, no trailing slash (e.g. "
                              "matomo.example.com or my.matomo.server/path)")
     self.site_id = \
         get_required_setting('MATOMO_SITE_ID', SITEID_RE,
                              "must be a (string containing a) number")
コード例 #9
0
 def __init__(self):
     self.domain_path = \
         get_required_setting('PIWIK_DOMAIN_PATH', DOMAINPATH_RE,
                              "must be a domain name, optionally followed "
                              "by an URI path, no trailing slash (e.g. "
                              "piwik.example.com or my.piwik.server/path)")
     self.site_id = \
         get_required_setting('PIWIK_SITE_ID', SITEID_RE,
                              "must be a (string containing a) number")
 def __init__(self):
     self.property_id = get_required_setting(
         'GOOGLE_ANALYTICS_GTAG_PROPERTY_ID', PROPERTY_ID_RE,
         '''must be a string looking like one of these patterns
         ('UA-XXXXXX-Y' , 'AW-XXXXXXXXXX',
         'G-XXXXXXXX', 'DC-XXXXXXXX')''')
     self.identity_function = getattr(settings, 'IDENTITY_FUNCTION', None)
コード例 #11
0
 def test_get_required_setting(self):
     """
     Make sure using get_required_setting fails in the right place.
     """
     with self.assertRaises(AnalyticalException) as e:
         user_id = get_required_setting("USER_ID", "\d+", "invalid USER_ID")
     self.assertEqual(e.exception.message, "USER_ID setting: not found")
コード例 #12
0
    def test_get_required_setting(self):
        """
        Make sure using get_required_setting fails in the right place.
        """

        # available in python >= 3.2
        if hasattr(self, 'assertRaisesRegex'):
            with self.assertRaisesRegex(AnalyticalException, "^USER_ID setting is not set$"):
                get_required_setting("USER_ID", r"\d+", "invalid USER_ID")
        # available in python >= 2.7, deprecated in 3.2
        elif hasattr(self, 'assertRaisesRegexp'):
            with self.assertRaisesRegexp(AnalyticalException, "^USER_ID setting is not set$"):
                get_required_setting("USER_ID", r"\d+", "invalid USER_ID")
        else:
            self.assertRaises(AnalyticalException,
                              get_required_setting, "USER_ID", r"\d+", "invalid USER_ID")
コード例 #13
0
 def __init__(self, is_required):
     if is_required:
         self.property_id = get_required_setting(
             'GOOGLE_ANALYTICS_JS_PROPERTY_ID', PROPERTY_ID_RE,
             "must be a string looking like 'UA-XXXXXX-Y'")
     else:
         # all good, just see if it's defined but don't complain if not
         self.property_id = getattr(settings, 'GOOGLE_ANALYTICS_JS_PROPERTY_ID', None)
コード例 #14
0
 def test_get_required_setting(self):
     """
     Make sure using get_required_setting fails in the right place.
     """
     # only available in python >= 2.7
     if hasattr(self, 'assertRaisesRegexp'):
         with self.assertRaisesRegexp(AnalyticalException, "^USER_ID setting: not found$"):
             user_id = get_required_setting("USER_ID", "\d+", "invalid USER_ID")
     else:
         self.assertRaises(AnalyticalException,
                           get_required_setting, "USER_ID", "\d+", "invalid USER_ID")
コード例 #15
0
def piwik_search(context, query, category=False, count=False):
    """
    Piwik search tracking template tag.

    Renders Javascript code to track internal page searches. See piwik tag.
    It takes 3 parameters:
      - Search string (required)
      - Search category (optional)
      - Result count (optional)
    """

    domain_path = \
        get_required_setting('PIWIK_DOMAIN_PATH', DOMAINPATH_RE,
                             "must be a domain name, optionally followed "
                             "by an URI path, no trailing slash (e.g. "
                             "piwik.example.com or my.piwik.server/path)")
    site_id = \
        get_required_setting('PIWIK_SITE_ID', SITEID_RE,
                             "must be a (string containing a) number")

    pretrack = _get_additional_calls(context)

    html = TRACKING_CODE % {
        'method':
        "['trackSiteSearch', %s, %s, %s]" % (
            json.dumps(query),
            json.dumps(category),
            json.dumps(count),
        ),
        'url':
        domain_path,
        'siteid':
        site_id,
        'pretrack':
        pretrack,
    }
    if is_internal_ip(context, 'PIWIK'):
        html = disable_html(html, 'Piwik')
    return html
コード例 #16
0
 def __init__(self):
     self.api_key = get_required_setting(
         'KISS_METRICS_API_KEY', API_KEY_RE,
         "must be a string containing a 40-digit hexadecimal number")
コード例 #17
0
 def __init__(self):
     self.site_id = get_required_setting('CLICKY_SITE_ID', SITE_ID_RE,
             "must be a (string containing) a number")
コード例 #18
0
 def __init__(self):
     self.default_widget_key = get_required_setting(
         'USERVOICE_WIDGET_KEY', WIDGET_KEY_RE,
         "must be an alphanumeric string")
コード例 #19
0
ファイル: hubspot.py プロジェクト: bittner/django-analytical
 def __init__(self):
     self.portal_id = get_required_setting('HUBSPOT_PORTAL_ID', PORTAL_ID_RE,
                                           "must be a (string containing a) number")
コード例 #20
0
ファイル: chartbeat.py プロジェクト: 01-/django-analytical
 def __init__(self):
     self.user_id = get_required_setting('CHARTBEAT_USER_ID', USER_ID_RE,
             "must be (a string containing) a number")
コード例 #21
0
ファイル: hubspot.py プロジェクト: Atala/META-SHARE
 def __init__(self):
     self.portal_id = get_required_setting('HUBSPOT_PORTAL_ID',
             PORTAL_ID_RE, "must be a (string containing a) number")
     self.domain = get_required_setting('HUBSPOT_DOMAIN',
             DOMAIN_RE, "must be an internet domain name")
コード例 #22
0
ファイル: reinvigorate.py プロジェクト: 01-/django-analytical
 def __init__(self):
     self.tracking_id = get_required_setting('REINVIGORATE_TRACKING_ID',
             TRACKING_ID_RE,
             "must be a string looking like XXXXX-XXXXXXXXXX")
コード例 #23
0
ファイル: kiss_metrics.py プロジェクト: 01-/django-analytical
 def __init__(self):
     self.api_key = get_required_setting('KISS_METRICS_API_KEY',
             API_KEY_RE,
             "must be a string containing a 40-digit hexadecimal number")
コード例 #24
0
 def __init__(self):
     self.counter_id = get_required_setting(
             'YANDEX_METRICA_COUNTER_ID', COUNTER_ID_RE,
             "must be (a string containing) a number'")
コード例 #25
0
 def __init__(self):
     self.widget_id = get_required_setting(
         'SNAPENGAGE_WIDGET_ID', WIDGET_ID_RE,
         "must be a string looking like this: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'")
コード例 #26
0
 def __init__(self):
     self.api_key = get_required_setting('PERFORMABLE_API_KEY', API_KEY_RE,
             "must be a string looking like 'XXXXX'")
コード例 #27
0
ファイル: crazy_egg.py プロジェクト: 01-/django-analytical
 def __init__(self):
     self.account_nr = get_required_setting('CRAZY_EGG_ACCOUNT_NUMBER',
             ACCOUNT_NUMBER_RE, "must be (a string containing) a number")
コード例 #28
0
ファイル: clickmap.py プロジェクト: 01-/django-analytical
 def __init__(self):
     self.tracker_id = get_required_setting('CLICKMAP_TRACKER_ID',
                                            CLICKMAP_TRACKER_ID_RE,
                                            "must be an alphanumeric string")
コード例 #29
0
 def __init__(self):
     self.property_id = get_required_setting(
         'GOOGLE_ANALYTICS_GTAG_PROPERTY_ID', PROPERTY_ID_RE,
         '''must be a string looking like one of these patterns
         ('UA-XXXXXX-Y' , 'AW-XXXXXXXXXX',
         'G-XXXXXXXX', 'DC-XXXXXXXX')''')
コード例 #30
0
 def __init__(self):
     self.user_id = get_required_setting(
         'CHARTBEAT_USER_ID', USER_ID_RE,
         "must be (a string containing) a number")
コード例 #31
0
 def __init__(self):
     self.tracker_id = get_required_setting(
         'CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE,
         "must be a (string containing) a number")
コード例 #32
0
ファイル: woopra.py プロジェクト: Superman8218/envs
 def __init__(self):
     self.domain = get_required_setting('WOOPRA_DOMAIN', DOMAIN_RE,
                                        "must be a domain name")
コード例 #33
0
ファイル: woopra.py プロジェクト: Atala/META-SHARE
 def __init__(self):
     self.domain = get_required_setting('WOOPRA_DOMAIN', DOMAIN_RE,
             "must be a domain name")
コード例 #34
0
 def __init__(self):
     self.app_id = get_required_setting(
             'INTERCOM_APP_ID', APP_ID_RE,
             "must be a string looking like 'XXXXXXX'")
コード例 #35
0
 def __init__(self):
     self.tracking_id = get_required_setting('SPRING_METRICS_TRACKING_ID',
         TRACKING_ID_RE, "must be a hexadecimal string")
コード例 #36
0
ファイル: mixpanel.py プロジェクト: arteria/django-analytical
 def __init__(self):
     self.token = get_required_setting(
         'MIXPANEL_API_TOKEN', MIXPANEL_API_TOKEN_RE,
         "must be a string containing a 32-digit hexadecimal number")
コード例 #37
0
 def __init__(self):
     self.counter_id = get_required_setting(
         'RATING_MAILRU_COUNTER_ID', COUNTER_ID_RE,
         "must be (a string containing) a number'")
コード例 #38
0
 def __init__(self):
     self.counter_id = get_required_setting(
             'RATING_MAILRU_COUNTER_ID', COUNTER_ID_RE,
             "must be (a string containing) a number'")
コード例 #39
0
 def __init__(self):
     self.portal_id = get_required_setting(
         'HUBSPOT_PORTAL_ID', PORTAL_ID_RE,
         "must be a (string containing a) number")
コード例 #40
0
 def __init__(self):
     self.site_id = get_required_setting(
         'GAUGES_SITE_ID', SITE_ID_RE,
         "must be a string looking like 'XXXXXXX'")
コード例 #41
0
 def __init__(self):
     self.property_id = get_required_setting(
         'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE,
         "must be a string looking like 'UA-XXXXXX-Y'")
コード例 #42
0
ファイル: olark.py プロジェクト: Rustemt/django-analytical
 def __init__(self):
     self.site_id = get_required_setting('OLARK_SITE_ID', SITE_ID_RE,
             "must be a string looking like 'XXXX-XXX-XX-XXXX'")
コード例 #43
0
ファイル: uservoice.py プロジェクト: JuliBakagianni/CEF-ELRC
 def __init__(self):
     self.default_widget_key = get_required_setting(
         "USERVOICE_WIDGET_KEY", WIDGET_KEY_RE, "must be an alphanumeric string"
     )
コード例 #44
0
 def __init__(self):
     self.app_id = get_required_setting(
             'INTERCOM_APP_ID', APP_ID_RE,
             "must be a string looking like 'XXXXXXX'")
コード例 #45
0
ファイル: clickmap.py プロジェクト: arteria/django-analytical
 def __init__(self):
     self.tracker_id = get_required_setting('CLICKMAP_TRACKER_ID',
             CLICKMAP_TRACKER_ID_RE,
             "must be a (string containing) a number")
コード例 #46
0
 def __init__(self):
     self.tracking_id = get_required_setting(
         'SPRING_METRICS_TRACKING_ID', TRACKING_ID_RE,
         "must be a hexadecimal string")
コード例 #47
0
 def __init__(self):
     self.token = get_required_setting(
             'MIXPANEL_API_TOKEN', MIXPANEL_API_TOKEN_RE,
             "must be a string containing a 32-digit hexadecimal number")
コード例 #48
0
 def __init__(self):
     self.tracking_id = get_required_setting(
         'REINVIGORATE_TRACKING_ID', TRACKING_ID_RE,
         "must be a string looking like XXXXX-XXXXXXXXXX")
コード例 #49
0
 def __init__(self):
     self.pixel_id = get_required_setting(
         'FACEBOOK_PIXEL_ID',
         re.compile(r'^\d+$'),
         "must be (a string containing) a number",
     )
コード例 #50
0
 def __init__(self):
     self.site_id = get_required_setting(
         'CLICKY_SITE_ID', SITE_ID_RE,
         "must be a (string containing) a number")
コード例 #51
0
 def __init__(self):
     self.counter_id = get_required_setting(
         'YANDEX_METRICA_COUNTER_ID', COUNTER_ID_RE,
         "must be (a string containing) a number'")
コード例 #52
0
 def __init__(self):
     self.property_id = get_required_setting(
             'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE,
             "must be a string looking like 'UA-XXXXXX-Y'")
コード例 #53
0
 def __init__(self):
     self.account_nr = get_required_setting(
         'CRAZY_EGG_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE,
         "must be (a string containing) a number")
コード例 #54
0
 def __init__(self):
     self.pixel_id = get_required_setting(
         'FACEBOOK_PIXEL_ID',
         re.compile(r'^\d+$'),
         "must be (a string containing) a number",
     )
コード例 #55
0
 def __init__(self):
     self.site_token = get_required_setting(
             'GOSQUARED_SITE_TOKEN', TOKEN_RE,
             "must be a string looking like XXX-XXXXXX-X")
コード例 #56
0
 def __init__(self):
     self.site_id = get_required_setting(
         'HOTJAR_SITE_ID',
         re.compile(r'^\d+$'),
         "must be (a string containing) a number",
     )
コード例 #57
0
 def __init__(self):
     self.tracker_id = get_required_setting(
         'CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE,
         "must be an alphanumeric string")