Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Match full urls with slash in param
Browse files Browse the repository at this point in the history
  • Loading branch information
grewn0uille committed Mar 8, 2018
1 parent fb6335a commit 49c34b3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sherlog/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from unrest import UnRest
from werkzeug.routing import PathConverter

from sherlog import graph
from sherlog.model import Log


class EverythingConverter(PathConverter):
regex = '.*?'


class Sherlog(Flask):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.config.from_envvar('FLASK_CONFIG')

self.before_request(self.before)

self.url_map.converters['everything'] = EverythingConverter

self.route('/graph/<server_name>/<ping_service>',
methods=['GET', 'POST'])(get_graph)
self.route('/graph/<ping_service>',
self.route('/graph/<everything:ping_service>',
methods=['GET', 'POST'])(get_graph)

self.route('/graph/day/<server_name>/<ping_service>',
methods=['GET', 'POST'])(get_graph_day)
self.route('/graph/day/<ping_service>',
self.route('/graph/day/<everything:ping_service>',
methods=['GET', 'POST'])(get_graph_day)

rest = UnRest(self, self.create_session())
Expand Down

0 comments on commit 49c34b3

Please sign in to comment.