Changeset - 04aea77a49fa
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 6 years ago 2019-12-19 22:39:38
mads@kiilerich.com
Grafted from: 4e0d9950c694
cleanup: safe_* functions live in utils2 - don't rely on re-export from utils
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/middleware/permanent_repo_url.py
Show inline comments
 
@@ -11,25 +11,26 @@
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.permanent_repo_url
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
middleware to handle permanent repo URLs, replacing PATH_INFO '/_123/yada' with
 
'/name/of/repo/yada' after looking 123 up in the database.
 
"""
 

	
 

	
 
from kallithea.lib.utils import fix_repo_id_name, safe_str
 
from kallithea.lib.utils import fix_repo_id_name
 
from kallithea.lib.utils2 import safe_str
 

	
 

	
 
class PermanentRepoUrl(object):
 

	
 
    def __init__(self, app, config):
 
        self.application = app
 
        self.config = config
 

	
 
    def __call__(self, environ, start_response):
 
        path_info = environ['PATH_INFO']
 
        if path_info.startswith('/'): # it must
 
            path_info = '/' + safe_str(fix_repo_id_name(path_info[1:]))
0 comments (0 inline, 0 general)