Den 23/01/2014 kl. 15.06 skrev Johannes Schneider 
<johannes.schnei...@galileo-press.de>:

> Hi List,
> see the question in the subject. I want to return from a management command 
> with a given exit code. How can this be done?


class Command(BaseCommand):
    def handle(self, *args, **options):
        try:
            # Something that may fail
        except TheException:
            # Clean up any transactions, open database connections etc.
            import sys
            sys.exit(123)


Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA6A370C-2D80-4C95-A75F-3AECE7021113%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to