Commit 62b886fe by Őry Máté

use settings api 2

parent 75d45516
from cloud.settings import DEBUG, STAT_DEBUG, RELEASE
from django.core.cache import cache
import subprocess
import json import json
import subprocess
from django.conf import settings
from django.core.cache import cache
def process_debug(req): def process_debug(req):
return {'DEBUG': DEBUG} return {'DEBUG': settings.DEBUG}
def process_stat(req): def process_stat(req):
if STAT_DEBUG: if settings.STAT_DEBUG:
stat = { stat = {
'CPU': { 'CPU': {
'USED_CPU': 10, 'USED_CPU': 10,
...@@ -23,11 +24,11 @@ def process_stat(req): ...@@ -23,11 +24,11 @@ def process_stat(req):
else: else:
stat = cache.get('cloud_stat') stat = cache.get('cloud_stat')
return { return {
'STAT_DEBUG': STAT_DEBUG, 'STAT_DEBUG': settings.STAT_DEBUG,
'cloud_stat': stat, 'cloud_stat': stat,
} }
def process_release(req): def process_release(req):
return { return {
'release': RELEASE, 'release': settings.RELEASE,
} }
from django.shortcuts import render_to_response
from django.http import HttpResponse
from firewall.models import *
from firewall.fw import *
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from django.db import IntegrityError
from tasks import *
from celery.task.control import inspect
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from cloud.settings import CLOUD_URL as url
from django.utils import translation
import re
import base64 import base64
import datetime
import json import json
import re
import sys import sys
import datetime from django.conf import settings
from django.db import IntegrityError
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.utils import translation
from django.utils.timezone import utc from django.utils.timezone import utc
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from celery.task.control import inspect
from tasks import *
from firewall.fw import *
from firewall.models import *
from one.tasks import SendMailTask from one.tasks import SendMailTask
def reload_firewall(request): def reload_firewall(request):
...@@ -52,7 +53,11 @@ def firewall_api(request): ...@@ -52,7 +53,11 @@ def firewall_api(request):
user = obj.host.owner user = obj.host.owner
lang = user.person_set.all()[0].language lang = user.person_set.all()[0].language
translation.activate(lang) translation.activate(lang)
msg = render_to_string('mails/notification-ban-now.txt', { 'user': user, 'bl': obj, 'instance:': obj.host.instance_set.get(), 'url': url} ) msg = render_to_string('mails/notification-ban-now.txt',
{ 'user': user,
'bl': obj,
'instance:': obj.host.instance_set.get(),
'url': settings.CLOUD_URL} )
SendMailTask.delay(to=obj.host.owner.email, subject='[IK Cloud] %s' % obj.host.instance_set.get().name, msg=msg, sender=u'cloud@ik.bme.hu') SendMailTask.delay(to=obj.host.owner.email, subject='[IK Cloud] %s' % obj.host.instance_set.get().name, msg=msg, sender=u'cloud@ik.bme.hu')
except (Host.DoesNotExist, ValidationError, IntegrityError, AttributeError): except (Host.DoesNotExist, ValidationError, IntegrityError, AttributeError):
pass pass
......
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