Commit 7dcacde4 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis Committed by Georgios D. Tsoukalas
Browse files

cmd version of project context

parent 5cda8dca
......@@ -35,7 +35,7 @@ from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from astakos.im.functions import check_expiration
from astakos.im.project_xctx import project_transaction_context
from astakos.im.project_xctx import cmd_project_transaction_context
class Command(BaseCommand):
help = "Perform administration checks on projects"
......@@ -86,7 +86,7 @@ class Command(BaseCommand):
if options['expire']:
self.expire(execute=execute)
@project_transaction_context(sync=True)
@cmd_project_transaction_context(sync=True)
def expire(self, execute=False, ctx=None):
try:
projects = check_expiration(execute=execute)
......
......@@ -37,7 +37,7 @@ from django.core.management.base import BaseCommand, CommandError
from astakos.im.models import ProjectApplication
from astakos.im.functions import approve_application
from astakos.im.project_xctx import project_transaction_context
from astakos.im.project_xctx import cmd_project_transaction_context
class Command(BaseCommand):
args = "<project application id>"
......@@ -54,7 +54,7 @@ class Command(BaseCommand):
else:
approve(id)
@project_transaction_context(sync=True)
@cmd_project_transaction_context(sync=True)
def approve(app, ctx=None):
try:
approve_application(app)
......
......@@ -35,7 +35,7 @@ from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from astakos.im.functions import terminate, suspend, resume
from astakos.im.project_xctx import project_transaction_context
from astakos.im.project_xctx import cmd_project_transaction_context
class Command(BaseCommand):
args = "<project id>"
......@@ -74,7 +74,7 @@ class Command(BaseCommand):
elif options['suspend']:
run_command(suspend, id)
@project_transaction_context(sync=True)
@cmd_project_transaction_context(sync=True)
def run_command(func, id, ctx=None):
try:
func(id)
......
......@@ -60,6 +60,10 @@ def project_transaction_context(**kwargs):
on_fail=project_error_view,
**kwargs)
def cmd_project_transaction_context(**kwargs):
return RetryTransactionHandler(ctx=ProjectTransactionContext,
**kwargs)
class ProjectTransactionContext(NotificationTransactionContext):
def __init__(self, sync=False, **kwargs):
self._sync = sync
......
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 to comment