<commit_before>"""
Rules for Accounts
"""

from smart.views import *

def check_my_account_wrapper(account):
    
    def check_my_account(request, view_func, view_args, view_kwargs):
        return view_kwargs['account_email'] == account.email

    return check_my_account



def check_unlimited_wrapper(account):

    def check(request, view_func, view_args, view_kwargs):
        try: 
            l = account.limitedaccount
        except Account.DoesNotExist:
            return True
            
        try:  
            return  view_kwargs['record_id'] == l.records.get().id
        except: 
            return False

    return check

def grant(account, permset):
    """
    grant the permissions of an account to this permset
    """
<commit_msg>Check limiteaccount when listing apps<commit_after>"""
Rules for Accounts
"""

from smart.views import *

def check_my_account_wrapper(account):
    
    def check_my_account(request, view_func, view_args, view_kwargs):
        return view_kwargs['account_email'] == account.email

    return check_my_account



def check_unlimited_wrapper(account):

    def check(request, view_func, view_args, view_kwargs):
        try: 
            l = account.limitedaccount
        except LimitedAccount.DoesNotExist:
            return True
            
        try:  
            return  view_kwargs['record_id'] == l.records.get().id
        except: 
            return False

    return check

def grant(account, permset):
    """
    grant the permissions of an account to this permset
    """

{'fraction_non_alphanumeric': 0.08274078862314156, 'fraction_numerical': 0.0, 'mean_word_length': 2.54233409610984, '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': '6798392', 'n_tokens_mistral': 442, 'n_tokens_neox': 431, 'n_words': 112}