def get_menu_entries(self, request): return [e for e in [ MenuEntry( text=_("Telemetry"), icon="fa fa-tachometer", url="shuup_admin:telemetry", category=SETTINGS_MENU_CATEGORY ) if is_telemetry_enabled() else None, ] if e]
def get_notifications(self, request): if is_telemetry_enabled() and is_in_grace_period() and not is_opt_out(): yield Notification( _("Statistics will be periodically sent to Shuup.com after 24 hours. Click here for more information."), title=_("Telemetry"), kind="info", url="shuup_admin:telemetry" )
def run(self): for schema in self.schemata: self.objects[schema["model"]] = self.process_schema(schema) if not OrderStatus.objects.exists(): print_("Creating order statuses...", end=" ") create_default_order_statuses() print_("done.") if not settings.DEBUG and is_telemetry_enabled(): try: data = json.dumps({"key": get_installation_key()}) resp = requests.get(url=settings.SHUUP_SUPPORT_ID_URL, data=data, timeout=5) if resp.json().get("support_id"): configuration.set(None, "shuup_support_id", resp.json().get("support_id")) except Exception: print_("Failed to get support id") print_("Initialization done.")
def run(self): for schema in self.schemata: self.objects[schema["model"]] = self.process_schema(schema) # Ensure default statuses are available print_("Creating order statuses...", end=" ") create_default_order_statuses() print_("done.") if not settings.DEBUG and is_telemetry_enabled(): try: data = json.dumps({ "key": get_installation_key() }) resp = requests.get(url=settings.SHUUP_SUPPORT_ID_URL, data=data, timeout=5) if resp.json().get("support_id"): configuration.set(None, "shuup_support_id", resp.json().get("support_id")) except Exception: print_("Failed to get support id") print_("Initialization done.")
def get_support_id(context): support_id = None if is_telemetry_enabled(): support_id = configuration.get(None, "shuup_support_id") return support_id