From 1fe98f434d3bb9ef4eae4721d9f322a5c5f5d196 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Mon, 22 Dec 2014 11:40:02 +0000 Subject: [PATCH] Random --- TODO.md | 12 +++++++++++- orchestra/admin/actions.py | 2 +- orchestra/utils/system.py | 39 +++++++++++++++++++++----------------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/TODO.md b/TODO.md index fcdfaba0..d0b87b3d 100644 --- a/TODO.md +++ b/TODO.md @@ -172,6 +172,8 @@ * Webapp options and type compatibility +* SaaS model splitted into SaaSUser and SaaSSite? + Multi-tenant WebApps -------------------- * SaaS - Those apps that can't use custom domain @@ -179,5 +181,13 @@ Multi-tenant WebApps * Howto upgrade webapp PHP version? SetHandler php54-cgi ? or create a new app - * prevent @pangea.org email addresses on contacts + + + + +* fcgid kill instead of apache reload? + + +* chomod user:group +* username maximum as group user in UNIX diff --git a/orchestra/admin/actions.py b/orchestra/admin/actions.py index 9231b128..1f5a32d1 100644 --- a/orchestra/admin/actions.py +++ b/orchestra/admin/actions.py @@ -64,7 +64,7 @@ class SendEmail(object): return render(request, self.template, self.context) def get_queryset_emails(self): - return self.queryset.value_list('email', flat=True) + return self.queryset.values_list('email', flat=True) def confirm_email(self, request, **options): email_from = options['email_from'] diff --git a/orchestra/utils/system.py b/orchestra/utils/system.py index dffcf6e6..0b25a1e9 100644 --- a/orchestra/utils/system.py +++ b/orchestra/utils/system.py @@ -61,30 +61,35 @@ def runiterator(command, display=False, error_codes=[0], silent=False, stdin='') make_async(p.stdout) make_async(p.stderr) - stdout = unicode() - stderr = unicode() - # Async reading of stdout and sterr while True: - # Wait for data to become available - select.select([p.stdout, p.stderr], [], []) + # TODO https://github.com/isagalaev/ijson/issues/15 + stdout = unicode() + sdterr = unicode() + # Get complete unicode chunks + while True: + select.select([p.stdout, p.stderr], [], []) + stdoutPiece = read_async(p.stdout) + stderrPiece = read_async(p.stderr) + try: + stdout += stdoutPiece.decode("utf8") + sdterr += stderrPiece.decode("utf8") + except UnicodeDecodeError: + pass + else: + break - # Try reading some data from each - stdoutPiece = read_async(p.stdout) - stderrPiece = read_async(p.stderr) - - if display and stdoutPiece: - sys.stdout.write(stdoutPiece) + if display and stdout: + sys.stdout.write(stdout) if display and stderrPiece: - sys.stderr.write(stderrPiece) + sys.stderr.write(stderr) - return_code = p.poll() - state = _AttributeUnicode(stdoutPiece.decode("utf8")) - state.stderr = stderrPiece.decode("utf8") - state.return_code = return_code + state = _AttributeUnicode(stdout) + state.stderr = sdterr + state.return_code = p.poll() yield state - if return_code != None: + if state.return_code != None: p.stdout.close() p.stderr.close() raise StopIteration