Permalink
Browse files

checking for the presence of a Django setting with hasattr

  • Loading branch information...
1 parent f4e1372 commit 596b9baebbf8ef9c113c2f7adae2a253e38dfa77 Luke Sneeringer committed Jan 22, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 __init__.py
View
@@ -763,9 +763,9 @@ class Charge(CheddarObject):
try:
from django.conf import settings
- if settings.CHEDDARGETTER_USERNAME and settings.CHEDDARGETTER_PASSWORD:
+ if hasattr(settings, 'CHEDDARGETTER_USERNAME') and hasattr(settings, 'CHEDDARGETTER_PASSWORD'):
CheddarGetter.auth(settings.CHEDDARGETTER_USERNAME, settings.CHEDDARGETTER_PASSWORD)
- if settings.CHEDDARGETTER_PRODUCT_CODE:
+ if hasattr(settings, 'CHEDDARGETTER_PRODUCT_CODE'):
CheddarGetter.set_product_code(settings.CHEDDARGETTER_PRODUCT_CODE)
except ImportError:
pass

0 comments on commit 596b9ba

Please sign in to comment.