from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict

def patterns(*args):
    subdomains = SortedDict()

    for x in args:
        name = x['name']

        if name in subdomains:
            raise ImproperlyConfigured("Duplicate subdomain name: %s" % name)
        if name == 'default':
            raise ImproperlyConfigured("Reserved subdomain name: %s" % name)

        subdomains[name] = x

    return subdomains

class subdomain(dict):
    def __init__(self, regex, urlconf, name, callback=None):
        self.update({
            'regex': regex,
            'urlconf': urlconf,
            'name': name,
        })

        if callback:
            self['callback'] = callback

from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict

def patterns(*args):
    subdomains = SortedDict()

    for x in args:
        name = x['name']

        if name in subdomains:
            raise ImproperlyConfigured("Duplicate subdomain name: %s" % name)

        subdomains[name] = x

    return subdomains

class subdomain(dict):
    def __init__(self, regex, urlconf, name, callback=None):
        self.update({
            'regex': regex,
            'urlconf': urlconf,
            'name': name,
        })

        if callback:
            self['callback'] = callback

Remove unnecessary protection against using "default" as a subdomainconf
Remove unnecessary protection against using "default" as a subdomainconf

Thanks to Jannis Leidel <jezdez@enn.io> for the pointer.

Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@playfire.com>

  from django.core.exceptions import ImproperlyConfigured
  from django.utils.datastructures import SortedDict
  
  def patterns(*args):
      subdomains = SortedDict()
  
      for x in args:
          name = x['name']
  
          if name in subdomains:
              raise ImproperlyConfigured("Duplicate subdomain name: %s" % name)
-         if name == 'default':
-             raise ImproperlyConfigured("Reserved subdomain name: %s" % name)
  
          subdomains[name] = x
  
      return subdomains
  
  class subdomain(dict):
      def __init__(self, regex, urlconf, name, callback=None):
          self.update({
              'regex': regex,
              'urlconf': urlconf,
              'name': name,
          })
  
          if callback:
              self['callback'] = callback
  
Remove unnecessary protection against using "default" as a subdomainconf
## Code Before:
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict

def patterns(*args):
    subdomains = SortedDict()

    for x in args:
        name = x['name']

        if name in subdomains:
            raise ImproperlyConfigured("Duplicate subdomain name: %s" % name)
        if name == 'default':
            raise ImproperlyConfigured("Reserved subdomain name: %s" % name)

        subdomains[name] = x

    return subdomains

class subdomain(dict):
    def __init__(self, regex, urlconf, name, callback=None):
        self.update({
            'regex': regex,
            'urlconf': urlconf,
            'name': name,
        })

        if callback:
            self['callback'] = callback

## Instruction:
Remove unnecessary protection against using "default" as a subdomainconf
## Code After:
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict

def patterns(*args):
    subdomains = SortedDict()

    for x in args:
        name = x['name']

        if name in subdomains:
            raise ImproperlyConfigured("Duplicate subdomain name: %s" % name)

        subdomains[name] = x

    return subdomains

class subdomain(dict):
    def __init__(self, regex, urlconf, name, callback=None):
        self.update({
            'regex': regex,
            'urlconf': urlconf,
            'name': name,
        })

        if callback:
            self['callback'] = callback
