Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
Prevent rule duplication in the root mapping.
Browse files Browse the repository at this point in the history
Signed-off-by: Laura <l@veriny.tf>
  • Loading branch information
Fuyukai committed Jul 31, 2017
1 parent c3e3c32 commit 5c8def1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Version 2.x.x

- Add :meth:`.Route.add_path`.

- Fix rules being duplicated in the root mapping.

Version 2.2.1
-------------

Expand Down
14 changes: 4 additions & 10 deletions kyoukai/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,12 @@ def finalize(self, **map_options) -> Map:
if self.finalized is True:
return self.map

routes = []
for child in self._children:
routes.append(child.get_submount())

routes.append(self.get_submount())

logger.info("Scanned {} route(s) over {} child blueprint(s) + {} route(s) in our "
"blueprint, building URL mapping now."
.format(len(routes), sum(1 for x in self.traverse_tree()), len(self.routes)))
submount = self.get_submount()
logger.info("Scanned {} route(s) in the routing tree, building routing mapping."
.format(sum(1 for x in submount.get_rules(submount))))

# Make a new Map() out of all of the routes.
rule_map = Map(routes, host_matching=self._host_matching, **map_options)
rule_map = Map([submount], host_matching=self._host_matching, **map_options)

logger.info("Built route mapping with {} rules.".format(len(rule_map._rules)))

Expand Down
2 changes: 1 addition & 1 deletion kyoukai/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_submount(self) -> Submount:
.. versionadded:: 2.2.0
.. versionchanged:: 2.2.2
.. versionchanged:: 2.x.x
Changed from getting a list of rules to a single submount object.
"""
Expand Down

0 comments on commit 5c8def1

Please sign in to comment.