Skip to content

Commit

Permalink
Merge pull request #34 from Lacrymology/dont-change-baseclass
Browse files Browse the repository at this point in the history
a little "fix", avoid changing base class by subclassing
  • Loading branch information
maccesch committed Oct 14, 2012
2 parents ad69dda + 870458e commit 95de714
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cmsplugin_contact/cms_plugins.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ class ContactForm(self.contact_form, AkismetContactForm):
pass pass
FormClass = ContactForm FormClass = ContactForm
elif instance.get_spam_protection_method_display() == 'ReCAPTCHA': elif instance.get_spam_protection_method_display() == 'ReCAPTCHA':
RecaptchaContactForm.recaptcha_public_key = getattr( #if you really want the user to be able to set the key in
settings, "RECAPTCHA_PUBLIC_KEY", # every form, this should be more flexible
instance.recaptcha_public_key)
RecaptchaContactForm.recaptcha_private_key = getattr(
settings, "RECAPTCHA_PRIVATE_KEY",
instance.recaptcha_private_key)
RecaptchaContactForm.recaptcha_theme = instance.recaptcha_theme
class ContactForm(self.contact_form, RecaptchaContactForm): class ContactForm(self.contact_form, RecaptchaContactForm):
pass recaptcha_public_key = getattr(
settings, "RECAPTCHA_PUBLIC_KEY",
instance.recaptcha_public_key)
recaptcha_private_key = getattr(
settings, "RECAPTCHA_PRIVATE_KEY",
instance.recaptcha_private_key)
recaptcha_theme = instance.recaptcha_theme

FormClass = ContactForm FormClass = ContactForm
else: else:
class ContactForm(self.contact_form, HoneyPotContactForm): class ContactForm(self.contact_form, HoneyPotContactForm):
Expand Down

0 comments on commit 95de714

Please sign in to comment.