From 813cfb6f65bce026fdf15a83a7e1c78dad04d0e5 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Mon, 10 Nov 2014 16:25:45 +0000 Subject: [PATCH] Fixed apache backend bug --- orchestra/apps/saas/models.py | 6 ++++++ orchestra/apps/websites/backends/apache.py | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/orchestra/apps/saas/models.py b/orchestra/apps/saas/models.py index b9b3a705..f6f8e5a7 100644 --- a/orchestra/apps/saas/models.py +++ b/orchestra/apps/saas/models.py @@ -11,6 +11,12 @@ from .services import SoftwareService class SaaS(models.Model): service = models.CharField(_("service"), max_length=32, choices=SoftwareService.get_plugin_choices()) + # TODO use model username password instead of data +# username = models.CharField(_("username"), max_length=64, unique=True, +# help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), +# validators=[validators.RegexValidator(r'^[\w.-]+$', +# _("Enter a valid username."), 'invalid')]) +# password = models.CharField(_("password"), max_length=128) account = models.ForeignKey('accounts.Account', verbose_name=_("account"), related_name='saas') data = JSONField(_("data")) diff --git a/orchestra/apps/websites/backends/apache.py b/orchestra/apps/websites/backends/apache.py index 9422c9d2..544dcec6 100644 --- a/orchestra/apps/websites/backends/apache.py +++ b/orchestra/apps/websites/backends/apache.py @@ -169,15 +169,15 @@ class Apache2Backend(ServiceController): "else UPDATED=0; fi" % context) def get_username(self, site): - option = site.options.filter('user_group') + option = site.options.filter(name='user_group').first() if option: - return option[0].split()[0] + return option.value.split()[0] return site.account.username def get_groupname(self, site): - option = site.options.filter('user_group') - if option and ' ' in option: - user, group = option.split() + option = site.options.filter(name='user_group').first() + if option and ' ' in option.value: + user, group = option.value.split() return group return site.account.username