|
|
@ -4,6 +4,7 @@ from django.conf import settings
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from jsonfield import JSONField
|
|
|
|
from jsonfield import JSONField
|
|
|
|
from datetime import timedelta
|
|
|
|
from datetime import timedelta
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
|
|
from ccvpn.common import get_price
|
|
|
|
from ccvpn.common import get_price
|
|
|
|
from .backends import BackendBase
|
|
|
|
from .backends import BackendBase
|
|
|
@ -103,6 +104,10 @@ class BackendData:
|
|
|
|
""" adds a backend data key to this instance's dict """
|
|
|
|
""" adds a backend data key to this instance's dict """
|
|
|
|
if not self.backend_data:
|
|
|
|
if not self.backend_data:
|
|
|
|
self.backend_data = {}
|
|
|
|
self.backend_data = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(self.backend_data, str):
|
|
|
|
|
|
|
|
self.backend_data = json.loads(self.backend_data) or {}
|
|
|
|
|
|
|
|
|
|
|
|
if not isinstance(self.backend_data, dict):
|
|
|
|
if not isinstance(self.backend_data, dict):
|
|
|
|
raise Exception("self.backend_data is not a dict (%r)" % self.backend_data)
|
|
|
|
raise Exception("self.backend_data is not a dict (%r)" % self.backend_data)
|
|
|
|
self.backend_data[key] = value
|
|
|
|
self.backend_data[key] = value
|
|
|
|