def add_setting_defaults(newdefaults):
    """
    This method can be used by other applications to define their
    default values.
    
    newdefaults has to be a dictionary containing name -> value of
    the settings.
    """
    sphsettings.add_setting_defaults(newdefaults)
Ejemplo n.º 2
0
def add_setting_defaults(newdefaults):
    """
    This method can be used by other applications to define their
    default values.
    
    newdefaults has to be a dictionary containing name -> value of
    the settings.
    """
    sphsettings.add_setting_defaults(newdefaults)
                                    {'citation':mark_safe(citation),
                                     'post':post,
                                     'memberlink':memberlink})

usecaptcha = True
try:
    from djaptcha.models import CaptchaRequest, CAPTCHA_ANSWER_OK
    #from django.db.models import permalink
    from sphene.community.middleware import get_current_request

    def captcha_request_get_absolute_url(self):
        return ('sphene.community.views.captcha_image', (), { 'token_id': self.id })
    get_absolute_captcha_url = sphpermalink(captcha_request_get_absolute_url)
    
    # update the captcha settings defaults (which can still be overridden by a set_sph_setting)
    sphsettings.add_setting_defaults({'community_email_anonymous_require_captcha': True})

    usecaptcha = True
except:
    usecaptcha = False

from random import random

def has_captcha_support():
    """ Determines if captcha support is currently enabled. """
    return usecaptcha

def generate_captcha():
    """
    Generates a captcha. and returns an object which has a method
    get_absolute_url() which returns the url to the captcha image and
Ejemplo n.º 4
0
usecaptcha = True
try:
    from djaptcha.models import CaptchaRequest, CAPTCHA_ANSWER_OK
    #from django.db.models import permalink
    from sphene.community.middleware import get_current_request, get_current_group

    def captcha_request_get_absolute_url(self):
        return ('sphene.community.views.captcha_image', (), {
            'token_id': self.id
        })

    get_absolute_captcha_url = sphpermalink(captcha_request_get_absolute_url,
                                            get_current_request)

    # update the captcha settings defaults (which can still be overridden by a set_sph_setting)
    sphsettings.add_setting_defaults(
        {'community_email_anonymous_require_captcha': True})

    usecaptcha = True
except:
    usecaptcha = False

from random import random


def has_captcha_support():
    """ Determines if captcha support is currently enabled. """
    return usecaptcha


def generate_captcha():
    """