<commit_before>from __future__ import absolute_import
import re
from django.core.cache import cache
from django.conf import settings
from django.utils.translation import ugettext as _

from casexml.apps.phone.xml import get_case_element
from casexml.apps.case.signals import case_post_save
from casexml.apps.case.util import get_close_case_xml, get_close_referral_xml,\
    couchable_property, get_case_xform_ids
from datetime import datetime
from couchdbkit.ext.django.schema import *
from casexml.apps.case import const
from dimagi.utils.modules import to_function
from dimagi.utils import parsing
import logging
from dimagi.utils.decorators.memoized import memoized
from dimagi.utils.indicators import ComputedDocumentMixin
from receiver.util import spoof_submission
from couchforms.models import XFormInstance
from casexml.apps.case.sharedmodels import IndexHoldingMixIn, CommCareCaseIndex
from copy import copy
import itertools
from dimagi.utils.couch.database import get_db, SafeSaveDocument
from couchdbkit.exceptions import ResourceNotFound, ResourceConflict
from dimagi.utils.couch import LooselyEqualDocumentSchema

"""
Couch models for commcare cases.  

For details on casexml check out:
http://bitbucket.org/javarosa/javarosa/wiki/casexml
"""

CASE_WRAPPER = to_function(getattr(settings, 'CASE_WRAPPER', None))

class CaseBase(SafeSaveDocument):
    """
    Base class for cases and referrals.
    """
    opened_on = DateTimeProperty()
    modified_on = DateTimeProperty()<commit_msg>don't break when CASE_WRAPPER setting isn't defined<commit_after>from __future__ import absolute_import
import re
from django.core.cache import cache
from django.conf import settings
from django.utils.translation import ugettext as _

from casexml.apps.phone.xml import get_case_element
from casexml.apps.case.signals import case_post_save
from casexml.apps.case.util import get_close_case_xml, get_close_referral_xml,\
    couchable_property, get_case_xform_ids
from datetime import datetime
from couchdbkit.ext.django.schema import *
from casexml.apps.case import const
from dimagi.utils.modules import to_function
from dimagi.utils import parsing
import logging
from dimagi.utils.decorators.memoized import memoized
from dimagi.utils.indicators import ComputedDocumentMixin
from receiver.util import spoof_submission
from couchforms.models import XFormInstance
from casexml.apps.case.sharedmodels import IndexHoldingMixIn, CommCareCaseIndex
from copy import copy
import itertools
from dimagi.utils.couch.database import get_db, SafeSaveDocument
from couchdbkit.exceptions import ResourceNotFound, ResourceConflict
from dimagi.utils.couch import LooselyEqualDocumentSchema

"""
Couch models for commcare cases.  

For details on casexml check out:
http://bitbucket.org/javarosa/javarosa/wiki/casexml
"""

if getattr(settings, 'CASE_WRAPPER', None):
    CASE_WRAPPER = to_function(getattr(settings, 'CASE_WRAPPER'))
else:
    CASE_WRAPPER = None

class CaseBase(SafeSaveDocument):
    """
    Base class for cases and referrals.
    """
    opened_on = DateTimeProperty()
    modified_on = DateTimeProperty()
{'fraction_non_alphanumeric': 0.06113256113256113, 'fraction_numerical': 0.0, 'mean_word_length': 6.002252252252252, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, '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': '785910', 'n_tokens_mistral': 901, 'n_tokens_neox': 891, 'n_words': 259}