Fixed apache backend bug

This commit is contained in:
Marc Aymerich 2014-11-10 16:25:45 +00:00
parent 42c696c6ec
commit 813cfb6f65
2 changed files with 11 additions and 5 deletions

View File

@ -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"))

View File

@ -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