예제 #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
 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
 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")
 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
 def __init__(self):
     self.portal_id = get_required_setting('HUBSPOT_PORTAL_ID', PORTAL_ID_RE,
                                           "must be a (string containing a) number")
예제 #20
0
 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
 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
 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
 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
 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
 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
 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
 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
 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")