Commit 06018f2d by Őry Máté

Merge branch 'issue-249' into 'master'

Save blank Profile.org_id as NULL #249
parents 30c3b225 95d3b15c
...@@ -48,7 +48,7 @@ from common.models import HumanReadableObject, create_readable, Encoder ...@@ -48,7 +48,7 @@ from common.models import HumanReadableObject, create_readable, Encoder
from vm.tasks.agent_tasks import add_keys, del_keys from vm.tasks.agent_tasks import add_keys, del_keys
from vm.models.instance import ACCESS_METHODS from vm.models.instance import ACCESS_METHODS
from .store_api import Store, NoStoreException, NotOkException from .store_api import Store, NoStoreException, NotOkException, Timeout
from .validators import connect_command_template_validator from .validators import connect_command_template_validator
logger = getLogger(__name__) logger = getLogger(__name__)
...@@ -201,6 +201,11 @@ class Profile(Model): ...@@ -201,6 +201,11 @@ class Profile(Model):
def __unicode__(self): def __unicode__(self):
return self.get_display_name() return self.get_display_name()
def save(self, *args, **kwargs):
if self.org_id == "":
self.org_id = None
super(Profile, self).save(*args, **kwargs)
class Meta: class Meta:
permissions = ( permissions = (
('use_autocomplete', _('Can use autocomplete.')), ('use_autocomplete', _('Can use autocomplete.')),
...@@ -341,7 +346,7 @@ def update_store_profile(sender, **kwargs): ...@@ -341,7 +346,7 @@ def update_store_profile(sender, **kwargs):
profile.disk_quota) profile.disk_quota)
except NoStoreException: except NoStoreException:
logger.debug("Store is not available.") logger.debug("Store is not available.")
except NotOkException: except (NotOkException, Timeout):
logger.critical("Store is not accepting connections.") logger.critical("Store is not accepting connections.")
......
...@@ -7,6 +7,7 @@ from datetime import datetime ...@@ -7,6 +7,7 @@ from datetime import datetime
from django.http import Http404 from django.http import Http404
from django.conf import settings from django.conf import settings
from requests import get, post, codes from requests import get, post, codes
from requests.exceptions import Timeout # noqa
from sizefield.utils import filesizeformat from sizefield.utils import filesizeformat
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment