<commit_before>from django.conf import settings

class PluginItem(object):

    def __init__(self, key, label, url, description, iconurl, student_access, examiner_access, admin_access):
        self.key = key
        self.label = label
        self.url = settings.DEVILRY_MAIN_PAGE + url
        self.icon = key + ".png"
        self.description = description
        self.student_access = student_access
        self.examiner_access = examiner_access
        self.admin_access = admin_access
    
    def can_show(self, student, examiner, admin):
        return (self.student_access and student) or (self.examiner_access and examiner) or (self.admin_access and admin)


_registry = {}

def register(key, label, url, description, icon=None, student_access=False, examiner_access=False, admin_access=False):
    r = PluginItem(key, label, url, description, icon, student_access, examiner_access, admin_access)
    #print "%s %s %s %s %s" % (key, label, url, icon, description)
    _registry[r.key] = r


def get(key):
    return _registry[key]<commit_msg>Prefixed urls in dashboard to make the site root dynamic.<commit_after>from django.conf import settings

class PluginItem(object):

    def __init__(self, key, label, url, description, iconurl, student_access, examiner_access, admin_access):
        self.key = key
        self.label = label

        if settings.DEVILRY_MAIN_PAGE.endswith('/'):
            self.url = settings.DEVILRY_MAIN_PAGE[:-1] + url
        else:
            self.url = settings.DEVILRY_MAIN_PAGE + url
        self.icon = key + ".png"
        self.description = description
        self.student_access = student_access
        self.examiner_access = examiner_access
        self.admin_access = admin_access
    
    def can_show(self, student, examiner, admin):
        return (self.student_access and student) or (self.examiner_access and examiner) or (self.admin_access and admin)


_registry = {}

def register(key, label, url, description, icon=None, student_access=False, examiner_access=False, admin_access=False):
    r = PluginItem(key, label, url, description, icon, student_access, examiner_access, admin_access)
    #print "%s %s %s %s %s" % (key, label, url, icon, description)
    _registry[r.key] = r


def get(key):
    return _registry[key]
{'fraction_non_alphanumeric': 0.10065645514223195, 'fraction_numerical': 0.000437636761487965, 'mean_word_length': 3.5177865612648223, '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': '130879', 'n_tokens_mistral': 704, 'n_tokens_neox': 674, 'n_words': 188}