Skip to content

Commit

Permalink
speed up configuration loading with tagged sources
Browse files Browse the repository at this point in the history
don't deepcopy whole SourceConfiguration object but only the parts
that change (i.e. the conf dict)
  • Loading branch information
olt committed Jan 10, 2013
1 parent 80f854c commit bac0464
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mapproxy/config/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import hashlib
import urlparse
import warnings
from copy import deepcopy
from copy import deepcopy, copy

import logging
log = logging.getLogger('mapproxy.config')
Expand Down Expand Up @@ -451,7 +451,9 @@ def __getitem__(self, key):
" tagged sources only supported for WMS/Mapserver/Mapnik" % key)

uses_req = source.conf.get('type') != 'mapnik'
source = deepcopy(source)

source = copy(source)
source.conf = deepcopy(source.conf)

if uses_req:
supported_layers = source.conf['req'].get('layers', [])
Expand All @@ -468,6 +470,7 @@ def __getitem__(self, key):
source.conf['req']['layers'] = layers
else:
source.conf['layers'] = layers

return source

def __contains__(self, key):
Expand Down

0 comments on commit bac0464

Please sign in to comment.