Exemplo n.º 1
0
def facebook_factory():
	"""Returns Facebook API object with either settings.TEST_* API parameters, or API parameters from site_settings"""
	if settings.INSIDE_TESTING:
		params = {'app_id': settings.TEST_FACEBOOK_APP_ID,'app_secret': settings.TEST_FACEBOOK_API_SECRET}
	else:
		params = {'app_id': get_setting('facebook_app_id'), 'app_secret': get_setting('facebook_api_secret')}
	return Facebook(**params)
Exemplo n.º 2
0
def facebook_factory():
    """Returns Facebook API object with either settings.TEST_* API parameters, or API parameters from site_settings"""
    if settings.INSIDE_TESTING:
        params = {
            'app_id': settings.TEST_FACEBOOK_APP_ID,
            'app_secret': settings.TEST_FACEBOOK_API_SECRET
        }
    else:
        params = {
            'app_id': get_setting('facebook_app_id'),
            'app_secret': get_setting('facebook_api_secret')
        }
    return Facebook(**params)
Exemplo n.º 3
0
	def render(self, context):
		result = get_setting(self.key, self.default)
		if self.asvar:
			context[self.asvar] = result
			return ''
		else:
			return result
Exemplo n.º 4
0
 def test_setting_translation(self):
 	s = Setting.objects.create()
 	s.site_name = "Example name"
 	s.save()
 	
 	trans_real.activate('es')
 	
 	s.site_name = "Example in Spanish"
 	s.save()
 	self.assertEquals(get_setting('site_name', ''), s.site_name)
Exemplo n.º 5
0
    def test_setting_translation(self):
        s = Setting.objects.create()
        s.site_name = "Example name"
        s.save()

        trans_real.activate('es')

        s.site_name = "Example in Spanish"
        s.save()
        self.assertEquals(get_setting('site_name', ''), s.site_name)
Exemplo n.º 6
0
def site_settings(request):
    ctx = {}
    
    if Site._meta.installed:
        site = Site.objects.get_current()
        ctx.update({
            "SITE_NAME": get_setting('site_name', site.name),
            "SITE_DOMAIN": site.domain
        })
    
    return ctx
Exemplo n.º 7
0
def email_send(sender, instance, created, raw, **kwargs):
    if not raw and created:
        if hasattr(instance.content_object, 'is_flagged'):
            instance.content_object.is_flagged = True
            instance.content_object.save()

        context = Context({'report': instance})
        subject = get_template('abuse_reports/new_report_subject.txt').render(context)
        context = Context({'subject': subject,'report':instance, 'SITE': Site.objects.get_current()})
        text = get_template('abuse_reports/new_report.html').render(context)
        
        to = get_setting("administrator_email")
        from_addr = settings.DEFAULT_FROM_EMAIL
        send_mail(subject, text, from_addr, [to], fail_silently=False)
Exemplo n.º 8
0
def email_send(sender, instance, created, raw, **kwargs):
    if not raw and created:
        if hasattr(instance.content_object, 'is_flagged'):
            instance.content_object.is_flagged = True
            instance.content_object.save()

        context = Context({'report': instance})
        subject = get_template('abuse_reports/new_report_subject.txt').render(
            context)
        context = Context({
            'subject': subject,
            'report': instance,
            'SITE': Site.objects.get_current()
        })
        text = get_template('abuse_reports/new_report.html').render(context)

        to = get_setting("administrator_email")
        from_addr = settings.DEFAULT_FROM_EMAIL
        send_mail(subject, text, from_addr, [to], fail_silently=False)
Exemplo n.º 9
0
 def inner_fn():
     from site_settings.helpers import get_setting
     return get_setting(key)
Exemplo n.º 10
0
 def test_setting_addition(self):
 	s = Setting()
 	s.site_name = "Example name"
 	s.save()
 	self.assertEquals(get_setting('site_name',''), "Example name")
Exemplo n.º 11
0
	def inner_fn():
		from site_settings.helpers import get_setting
		return get_setting(key)
Exemplo n.º 12
0
 def test_setting_addition(self):
     s = Setting()
     s.site_name = "Example name"
     s.save()
     self.assertEquals(get_setting('site_name', ''), "Example name")
Exemplo n.º 13
0
def site_logo(size="241x46"):
	return {'logo': get_setting('site_logo'), 'size': size}