<commit_before>#from django.template import loader, TemplateDoesNotExist
#from cms.utils import get_template_from_request
#from django.template.context import RequestContext
#from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import Site
from cms.templatetags.cms_tags import PlaceholderNode
from django.template.loader import find_template
from django.template import Lexer,
#import re
        
def get_placeholders(template):
    source, origin = find_template(template)
    lexer = Lexer(source, origin)
    placeholders = []
    for token in [t for t in lexer.tokenize() if t.token_type == 2]:
        bits = token.split_contents()
        if bits[0] == 'placeholder':
            placeholders.append(bits[1].strip('"\''))
    return placeholders


SITE_VAR = "site__exact"

def current_site(request):
    if SITE_VAR in request.REQUEST:
        return Site.objects.get(pk=request.REQUEST[SITE_VAR])
    else:
        site_pk = request.session.get('cms_admin_site', None)
        if site_pk:
            try:
                return Site.objects.get(pk=site_pk)
            except Site.DoesNotExist:
                return None
        else:
            return Site.objects.get_current()<commit_msg>fixed cms.utils.plugins<commit_after>from django.contrib.sites.models import Site
from cms.templatetags.cms_tags import PlaceholderNode
from django.template.loader import find_template
from django.template import Lexer
        
def get_placeholders(template):
    source, origin = find_template(template)
    lexer = Lexer(source, origin)
    placeholders = []
    for token in [t for t in lexer.tokenize() if t.token_type == 2]:
        bits = token.split_contents()
        if bits[0] == 'placeholder':
            placeholders.append(bits[1].strip('"\''))
    return placeholders


SITE_VAR = "site__exact"

def current_site(request):
    if SITE_VAR in request.REQUEST:
        return Site.objects.get(pk=request.REQUEST[SITE_VAR])
    else:
        site_pk = request.session.get('cms_admin_site', None)
        if site_pk:
            try:
                return Site.objects.get(pk=site_pk)
            except Site.DoesNotExist:
                return None
        else:
            return Site.objects.get_current()
{'fraction_non_alphanumeric': 0.09296148738379814, 'fraction_numerical': 0.0026560424966799467, 'mean_word_length': 2.9510489510489513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1959813', 'n_tokens_mistral': 672, 'n_tokens_neox': 654, 'n_words': 159}