from django.conf import settings
from bakery.management.commands.publish import Command as BaseCommand


class Command(BaseCommand):

    def handle(self, *args, **options):
        # When in BIGBUILD_BRANCH_BUILD don't delete because we'll be syncing
        # a different subdirectory for each one of our git branches
        if settings.BIGBUILD_BRANCH_BUILD:
            options['no_delete'] = True
        super(Command, self).handle(*args, **options)

from django.conf import settings
from bakery.management.commands.publish import Command as BaseCommand


class Command(BaseCommand):

    def handle(self, *args, **options):
        # When in BIGBUILD_BRANCH_BUILD don't delete because we'll be syncing
        # a different subdirectory for each one of our git branches
        if getattr(settings, 'BIGBUILD_BRANCH_BUILD', False):
            options['no_delete'] = True
        super(Command, self).handle(*args, **options)

Make an attribute call a little smarter
Make an attribute call a little smarter

  from django.conf import settings
  from bakery.management.commands.publish import Command as BaseCommand
  
  
  class Command(BaseCommand):
  
      def handle(self, *args, **options):
          # When in BIGBUILD_BRANCH_BUILD don't delete because we'll be syncing
          # a different subdirectory for each one of our git branches
-         if settings.BIGBUILD_BRANCH_BUILD:
+         if getattr(settings, 'BIGBUILD_BRANCH_BUILD', False):
              options['no_delete'] = True
          super(Command, self).handle(*args, **options)
  
Make an attribute call a little smarter
## Code Before:
from django.conf import settings
from bakery.management.commands.publish import Command as BaseCommand


class Command(BaseCommand):

    def handle(self, *args, **options):
        # When in BIGBUILD_BRANCH_BUILD don't delete because we'll be syncing
        # a different subdirectory for each one of our git branches
        if settings.BIGBUILD_BRANCH_BUILD:
            options['no_delete'] = True
        super(Command, self).handle(*args, **options)

## Instruction:
Make an attribute call a little smarter
## Code After:
from django.conf import settings
from bakery.management.commands.publish import Command as BaseCommand


class Command(BaseCommand):

    def handle(self, *args, **options):
        # When in BIGBUILD_BRANCH_BUILD don't delete because we'll be syncing
        # a different subdirectory for each one of our git branches
        if getattr(settings, 'BIGBUILD_BRANCH_BUILD', False):
            options['no_delete'] = True
        super(Command, self).handle(*args, **options)
