Skip to content

Commit

Permalink
Remove SubMapper in config.routes as we now have a compatable routes …
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
tobes committed Dec 13, 2012
1 parent c750865 commit 36fab6a
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions ckan/config/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re

from pylons import config
from routes import Mapper as _Mapper
from routes.mapper import SubMapper, Mapper as _Mapper

from ckan.plugins import PluginImplementations, IRoutes

Expand Down Expand Up @@ -425,36 +425,3 @@ def make_map():
map.connect('/*url', controller='template', action='view')

return map

class SubMapper(object):
# FIXME this is only used due to a bug in routes 1.11
# hopefully we can use map.submapper(...) in version 1.12
"""Partial mapper for use with_options"""
def __init__(self, obj, **kwargs):
self.kwargs = kwargs
self.obj = obj

def connect(self, *args, **kwargs):
newkargs = {}
newargs = args
for key in self.kwargs:
if key == 'path_prefix':
if len(args) > 1:
newargs = (args[0], self.kwargs[key] + args[1])
else:
newargs = (self.kwargs[key] + args[0],)
elif key in kwargs:
newkargs[key] = self.kwargs[key] + kwargs[key]
else:
newkargs[key] = self.kwargs[key]
for key in kwargs:
if key not in self.kwargs:
newkargs[key] = kwargs[key]
return self.obj.connect(*newargs, **newkargs)

# Provided for those who prefer using the 'with' syntax in Python 2.5+
def __enter__(self):
return self

def __exit__(self, type, value, tb):
pass

0 comments on commit 36fab6a

Please sign in to comment.