# Path: findingaids/utils.py
# def normalize_whitespace(txt):
#     'Normalize whitespace in a string'
#     return re.sub(_normalize_ws_re, ' ', txt)


from datetime import datetime
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.db import models
from eulxml import xmlmap
from eulxml.xmlmap import eadmap
from eulexistdb.manager import Manager
from eulexistdb.models import XmlModel
from findingaids.utils import normalize_whitespace
import logging
import os
    """
    eadid = models.CharField('EAD Identifier', max_length=50, unique=True)
    title = models.CharField(max_length=200)
    date = models.DateTimeField('Date removed', auto_now_add=True)
    note = models.CharField(
        max_length=400, blank=True,
        help_text="Optional: Enter the reason this document is being deleted. " +
                  "These comments will be displayed to anyone who had the finding " +
                  "aid bookmarked and returns after it is gone.")

    class Meta:
        verbose_name = 'Deleted Record'

    def __unicode__(self):
        return self.eadid


class Archive(models.Model):
    '''Model to define Archives associated with EAD documents, for use with
    admin user permissions and to identify subversion repositories where
    content will be published from.'''
    label = models.CharField(max_length=10,
        help_text='Short label to identify an archive')
    name = models.CharField(max_length=255,
        help_text='repository name (subarea) in EAD to identify finding aids associated with this archive')
    svn = models.URLField('Subversion Repository',
        help_text='URL to subversion repository containing EAD for this archive')
    slug = models.SlugField(help_text='''shorthand id
        (auto-generated from label; do not modify after initial archive definition)''')
    contacts = models.ManyToManyField(settings.AUTH_USER_MODEL,

# Path: findingaids/utils.py
# def normalize_whitespace(txt):
#     'Normalize whitespace in a string'
#     return re.sub(_normalize_ws_re, ' ', txt)


# Path: findingaids/fa/models.py
from datetime import datetime
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.db import models
from eulxml import xmlmap
from eulxml.xmlmap import eadmap
from eulexistdb.manager import Manager
from eulexistdb.models import XmlModel
from findingaids.utils import normalize_whitespace
import logging
import os

    """
    eadid = models.CharField('EAD Identifier', max_length=50, unique=True)
    title = models.CharField(max_length=200)
    date = models.DateTimeField('Date removed', auto_now_add=True)
    note = models.CharField(
        max_length=400, blank=True,
        help_text="Optional: Enter the reason this document is being deleted. " +
                  "These comments will be displayed to anyone who had the finding " +
                  "aid bookmarked and returns after it is gone.")

    class Meta:
        verbose_name = 'Deleted Record'

    def __unicode__(self):
        return self.eadid


class Archive(models.Model):
    '''Model to define Archives associated with EAD documents, for use with
    admin user permissions and to identify subversion repositories where
    content will be published from.'''
    label = models.CharField(max_length=10,
        help_text='Short label to identify an archive')
    name = models.CharField(max_length=255,
        help_text='repository name (subarea) in EAD to identify finding aids associated with this archive')
    svn = models.URLField('Subversion Repository',
        help_text='URL to subversion repository containing EAD for this archive')
    slug = models.SlugField(help_text='''shorthand id
        (auto-generated from label; do not modify after initial archive definition)''')
    contacts = models.ManyToManyField(settings.AUTH_USER_MODEL,

        help_text='Contact person for display on the Request Materials page (email required)',