In my django project I have written some custom management commands which run on the server. These custom commands in turn call different functions during execution. I want a way to set a global variable/field or a way to find out what command is being executed. One obvious usage is write log messages, so that it can identified what command they are coming from.
A simplified version is:
In one module I have:
########
class Command(BaseCommand):
args = ''
help = 'Identifies inconsistent data between activity_log and User points collcetion. This will overwrite the previous inconsistencies identified'
def handle(self, *args, **options):
functionA()
In another module I have:
########
class Command(BaseCommand):
args = ''
help = 'Identifies inconsistent data between activity_log and User points collcetion. This will overwrite the previous inconsistencies identified'
def handle(self, *args, **options):
functionA()
########
def FuncA()
# I want a way to findout where it was called from / What command is being executed.
# I can do parameters but there is complex chain of functions being called and passing parameter in each would be too tedious.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment